-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Autocomplete] Fix aria-controls and aria-activedescendant #18142
Conversation
|
||
fireEvent.keyDown(document.activeElement, { key: 'Escape' }); | ||
|
||
expect(handleClose.callCount).to.equal(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be called twice with jsdom actual because the implementation includes a .focus() noop that causes jsdom to fire a blur event which also calls onClose. In the browser this will work correctly.
0efec53
to
24b80cb
Compare
Details of bundle changes.Comparing: 13b3a0d...24b80cb
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So cool to have these new tests :)
}), | ||
getListboxProps: () => ({ | ||
role: 'listbox', | ||
id: `${id}-listbox`, | ||
id: `${id}-popup`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the role of this element is listbox
, should we suffix the id with -listbox
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The popup is the generic term for the "list" of possible items. It can also be a grid or tree. It makes more sense if you look at the aria-controls which doesn't care if you have a listbox or grid or tree. Just that the element in question is the popup with the possible items.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems correct, oops 🙃. What do you think of killing the getPopupProps()
method and renaming PopupComponent
to PopperComponent
? (for future changes)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why Popup to Popper?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought that the popup was a different element to the listbox. As you raised it out, it's not. Because the default value for PopupComponent is a Popper, the change could make the API more intuitive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that makes sense.
I'm splitting work into smaller chunks starting with closing #18132
Tests https://www.w3.org/TR/wai-aria-1.1/#combobox except accessible name computation and keyboard navigation.
I'll remove the
jsdom
patch once this gets approved. It's easier to see that this is an issue with jsdom not our implementation