radix-ui / primitives

Radix Primitives is an open-source UI component library for building high-quality, accessible design systems and web apps. Maintained by @workos.
https://radix-ui.com/primitives
MIT License
15.77k stars 818 forks source link

`Select` pressing `home`/`end` keys when open, doesn't highlight first/last item #1570

Open sketchbuch opened 2 years ago

sketchbuch commented 2 years ago

Note from maintainer Original issue was reworded slightly to cover for a different subset, see here for more details: https://github.com/radix-ui/primitives/issues/1570#issuecomment-1201328110


Bug report

Current Behavior

Home and end do nothing but scroll the page

Expected behavior

As described here (https://www.w3.org/WAI/ARIA/apg/example-index/combobox/combobox-select-only.html), select should open if closed and highlight the first/last item depending upon the button pressed.

Reproducible example

https://www.radix-ui.com/docs/primitives/components/select

Suggested solution

Implement the expected keyboard controls as listed here: https://www.w3.org/WAI/ARIA/apg/example-index/combobox/combobox-select-only.html

Additional context

Your environment

Software Name(s) Version
Radix Package(s)
React n/a
Browser Chrome 103.0
Assistive tech
Node n/a
npm/yarn
Operating System Ubuntu 22.04
benoitgrelard commented 2 years ago

Hi @sketchbuch, I think it's arguable whether an implementation should allow home to open and highlight the first and end to open and highlight the last, given a user won't know what it picks without seeing the options first.

Also note that the link you send is for a specific implementation rather than the aria guidelines:

The example combobox on this page implements the following keyboard interface. Other variations and options for the keyboard interface are described in the Keyboard Interaction section of the combobox design pattern.

On the given guidelines link, you'll see there's no mention of this being a requirement for the closed state. There is however an "optional" requirement for the open state to highlight the first/last using those keys.

We do support those for our menus so it seems like a simple omission here in Select which we would want to cover. I will reword the issue slightly and keep it open so we can get to it.