Skip to content

Commit

Permalink
fix(ffe-searchable-dropdown-react): fixes isse in talkback
Browse files Browse the repository at this point in the history
  • Loading branch information
pethel committed Mar 28, 2021
1 parent d51fd82 commit 706bc18
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
12 changes: 4 additions & 8 deletions packages/ffe-searchable-dropdown-react/src/SearchableDropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ const SearchableDropdown = ({
'aria-invalid': ariaInvalid,
}) => {
const inputEl = useRef(null);

const initialSelectedItem = useMemo(
() => dropdownList.find(item => isEqual(initialValue, item)),
[dropdownList, initialValue],
Expand Down Expand Up @@ -79,8 +78,8 @@ const SearchableDropdown = ({
highlightedIndex,
selectedItem,
openMenu,
closeMenu,
clearSelection,
getToggleButtonProps,
}) => {
const trimmedInput = inputValue.trim();

Expand Down Expand Up @@ -122,11 +121,9 @@ const SearchableDropdown = ({
'ffe-input-field--dark': dark,
}),
onFocus: (...args) => {
openMenu();
onFocus(...args);
},
onBlur: (...args) => {
closeMenu();
onBlur(...args);
},
onClick: (...args) => {
Expand All @@ -148,11 +145,11 @@ const SearchableDropdown = ({
className="ffe-searchable-dropdown__button ffe-searchable-dropdown__button--cross"
onClick={clearSelection}
>
<KryssIkon />
<KryssIkon aria-hidden="true" />
</button>
) : (
<button
type="button"
{...getToggleButtonProps()}
aria-label={
isOpen
? getButtonLabelClose(locale)
Expand All @@ -164,9 +161,8 @@ const SearchableDropdown = ({
'ffe-searchable-dropdown__button--flip': isOpen,
},
)}
onClick={isOpen ? closeMenu : openMenu}
>
<ChevronIkon />
<ChevronIkon aria-hidden="true" />
</button>
)}
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ describe('SearchableDropdown', () => {

const input = getByPlaceholderText(placeholder);

fireEvent.focus(input);
fireEvent.click(input);

expect(getByText('Bedriften')).toBeInTheDocument();
expect(getByText('912602370')).toBeInTheDocument();
Expand Down

0 comments on commit 706bc18

Please sign in to comment.