Skip to content

Commit

Permalink
ENH Improve hover active and focus state styling
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Jan 26, 2024
1 parent 7e077dc commit 9be6397
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 11 deletions.
2 changes: 1 addition & 1 deletion client/dist/js/bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/dist/styles/bundle.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions client/src/components/LinkField/LinkField.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,13 @@
.link-field__save-record-first {
padding-top: 7px;
}

.link-field__container .btn-link {
position: absolute;
right: 0;

&:focus,
&:not(:disabled):not(.disabled):active {
box-shadow: none;
}
}
2 changes: 1 addition & 1 deletion client/src/components/LinkPicker/LinkPicker.scss
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
}

&--draft::before {
background-color: $state-draft-bg;;
background-color: $state-draft-bg;
}

&--modified::before {
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/LinkPicker/LinkPickerMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const LinkPickerMenu = ({ types, onSelect }) => {
toggle={toggle}
className="link-picker__menu"
>
<DropdownToggle className="link-picker__menu-toggle font-icon-plus-1" caret>
<DropdownToggle className="link-picker__menu-toggle font-icon-plus-1" caret color="secondary">
{i18n._t('LinkField.ADD_LINK', 'Add Link')}
</DropdownToggle>
<DropdownMenu>
Expand Down
6 changes: 3 additions & 3 deletions client/src/components/LinkPicker/LinkPickerTitle.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ const LinkPickerTitle = ({
<span className="link-picker__url">{description}</span>
</small>
</div>
{(canDelete && !readonly) &&
<span className="link-picker__delete btn btn-link" onClick={stopPropagation(() => !loading ? onDelete(id) : null)}>{deleteText}</span>
}
</Button>
{(canDelete && !readonly) &&
<Button disabled={loading} className="link-picker__delete" color="link" onClick={stopPropagation(() => onDelete(id))}>{deleteText}</Button>
}
</div>
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ test('LinkPickerTitle delete button should fire the onDelete callback when not l
})}
/>
</LinkFieldContext.Provider>);
fireEvent.click(container.querySelector('button.link-picker__delete'));
fireEvent.click(container.querySelector('.link-picker__delete'));
expect(mockOnDelete).toHaveBeenCalledTimes(1);
});

Expand All @@ -70,7 +70,7 @@ test('LinkPickerTitle delete button should not fire the onDelete callback while
})}
/>
</LinkFieldContext.Provider>);
fireEvent.click(container.querySelector('button.link-picker__delete'));
fireEvent.click(container.querySelector('.link-picker__delete'));
expect(mockOnDelete).toHaveBeenCalledTimes(0);
});

Expand All @@ -79,7 +79,7 @@ test('LinkPickerTitle main button should fire the onClick callback when not load
const { container } = render(<LinkFieldContext.Provider value={{ loading: false }}>
<LinkPickerTitle {...makeProps({ onClick: mockOnClick })} />
</LinkFieldContext.Provider>);
fireEvent.click(container.querySelector('button.link-picker__button'));
fireEvent.click(container.querySelector('.link-picker__button'));
expect(mockOnClick).toHaveBeenCalledTimes(1);
});

Expand All @@ -88,7 +88,7 @@ test('LinkPickerTitle main button should not fire the onClick callback while loa
const { container } = render(<LinkFieldContext.Provider value={{ loading: true }}>
<LinkPickerTitle {...makeProps({ onClick: mockOnClick })} />
</LinkFieldContext.Provider>);
fireEvent.click(container.querySelector('button.link-picker__button'));
fireEvent.click(container.querySelector('.link-picker__button'));
expect(mockOnClick).toHaveBeenCalledTimes(0);
});

Expand Down

0 comments on commit 9be6397

Please sign in to comment.