You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Initially, I wanted to add an <input role="searchbox"> element as a child of Listbox.Options, but it turns out that Listbox.Options already has role="listbox" defined and therefore it expects children to be selectable options.
After that, I’ve tried to create a popover with role="dialog" and then embed the search input and Listbox.Options as siblings, but in that case, the input can’t access and apply the aria-activedescendant used within the listbox options container.
Adding two new, optional components, namely Listbox.FilterInput and Listbox.Popover could mitigate the issue – when they’re used:
Listbox.Popover should be responsible for locking focus and detecting outside clicks instead of Listbox.Options
Listbox.Button should use aria-haspopup="dialog" instead of "listbox", while Listbox.Optionsshould retain the"listbox"` role
Listbox.FilterInput should be a sibling of Listbox.Options and should have role="searchbox" (or "combobox"?), along with aria-controlsandaria-activedescendantattributes referencing the active item withinListbox.Options`
Unfortunately, I couldn’t find a way to implement this in userland, mainly due to the fact that listbox items aren’t announced anymore when an input within the options popover is focused 😕
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
Firstly, I’d like to express my gratitude for the amount of effort that goes into this project.
I wanted to combine Listbox and Combobox similarly to how Ariakit does it:
Initially, I wanted to add an
<input role="searchbox">
element as a child ofListbox.Options
, but it turns out thatListbox.Options
already hasrole="listbox"
defined and therefore it expects children to be selectable options.After that, I’ve tried to create a popover with
role="dialog"
and then embed the search input andListbox.Options
as siblings, but in that case, the input can’t access and apply thearia-activedescendant
used within the listbox options container.Adding two new, optional components, namely
Listbox.FilterInput
andListbox.Popover
could mitigate the issue – when they’re used:Listbox.Popover
should be responsible for locking focus and detecting outside clicks instead ofListbox.Options
Listbox.Button
should usearia-haspopup="dialog"
instead of"listbox", while
Listbox.Optionsshould retain the
"listbox"` roleListbox.FilterInput
should be a sibling ofListbox.Options
and should haverole="searchbox"
(or"combobox"?), along with
aria-controlsand
aria-activedescendantattributes referencing the active item within
Listbox.Options`Unfortunately, I couldn’t find a way to implement this in userland, mainly due to the fact that listbox items aren’t announced anymore when an input within the options popover is focused 😕
Here’s a brief draft of my API proposal, based upon the basic example within the docs:
Beta Was this translation helpful? Give feedback.
All reactions