Skip to content

Commit

Permalink
Fix invalid aria values (#438)
Browse files Browse the repository at this point in the history
  • Loading branch information
ericgio committed Apr 25, 2019
1 parent d9aab6d commit f83e178
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/__tests__/components/Typeahead.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@ describe('<Typeahead>', () => {

describe('accessibility attributes', () => {
test('adds an id to the menu for accessibility', () => {
expect(getInput(typeahead).prop('aria-owns')).toBe('');
expect(getInput(typeahead).prop('aria-owns')).toBe(undefined);

focus(typeahead);

Expand Down Expand Up @@ -950,7 +950,7 @@ describe('<Typeahead>', () => {

test('sets the input `aria-activedescendant` description', () => {
typeahead.setProps({ id: 'my-id' });
expect(getInput(typeahead).prop('aria-activedescendant')).toBe('');
expect(getInput(typeahead).prop('aria-activedescendant')).toBe(undefined);

focus(typeahead);
keyDown(typeahead, DOWN);
Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/utils/getInputProps.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ const baseMultiProps = {
};

const baseReceivedProps = {
'aria-activedescendant': '',
'aria-activedescendant': undefined,
'aria-autocomplete': 'both',
'aria-expanded': false,
'aria-haspopup': 'listbox',
'aria-owns': '',
'aria-owns': undefined,
autoComplete: 'off',
className: '',
onClick: undefined,
Expand Down
4 changes: 2 additions & 2 deletions src/utils/getInputProps.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ const getInputProps = ({
...rest,
'aria-activedescendant': activeIndex >= 0 ?
getMenuItemId(id, activeIndex) :
'',
undefined,
'aria-autocomplete': 'both',
'aria-expanded': isMenuShown,
'aria-haspopup': 'listbox',
'aria-owns': isMenuShown ? id : '',
'aria-owns': isMenuShown ? id : undefined,
className: cx({
[className || '']: !multiple,
focus: isFocused,
Expand Down

0 comments on commit f83e178

Please sign in to comment.