Closed thefirstartist closed 12 months ago
We are using the browser default Select
under the hood in Pagination
, without any additional keyboard handling. The two implementations (Select and Pagination) should match:
I am unable to open a browser default Select
element with Enter
, and I am not seeing focus move from one Select
to the next on Tab press when a menu is open. https://stackblitz.com/edit/github-xdecs2?file=src%2FApp.jsx
Dropdown is a custom Carbon listbox that is powered by Downshift
under the hood.
I'd like to know what @mbgower thinks about this one, and if the browser default Select
element needs additional handlers.
As @tw15egan points out, what you folks are encountering is the native HTML select
component behaviour on a Mac. While I agree with Sam that it would be nice if it behaved like a dropdown and opened on Enter, the fact is that it does not.
Note that if you are on a Windows system, you can Tab away from an open select (or, more accurately, pressing Tab will collapse an open select, populating it with the item with focus, and then you press Tab again to move). But the same open-with-spacebar limitation exists on the Windows system. It also won't open with down arrow on either OS (it simply cycles through the choices without opening).
So this isn't a bug. It is expected behaviour.
In regard to the request to make arrow keys move between components, it would be technically very difficult to do here, and I don't see it as necessary or even better. The values in a Select are cycled with both the up/down arrow keys AND the left/right arrow keys. So how would you be able to move away from a select with an arrow key? The normal way of moving away from an input is Tab, and that works fine here.
Yes, it would be nice if it behaved like a dropdown and expand on Enter. It's an expected behavior for a dropdown, accordion, and most elements with a chevron icon. I understand the native HTML select component does not support Enter on a Mac, but it looks like a defect from users' perspective. Enter key expands and collapses dropdowns on Gmail, Yahoo mail, Google, and it also works on Oracle, Salesforce, and pretty much everywhere I familiar with.
We purposely do not override any of the browser defaults for the Select
component. All of these functionalities should exist in the Dropdown
component, so outside of the Pagination
component, you can use that.
I believe the reason we use Select
in the Pagination
component is because it is better suited to handle large lists of numbers (we've gotten issues that people have hundreds of items in their Pagination
select), and will overlay any containers with overflow: hidden
it is contained inside. Once the floating-ui
improvements have been made (https://github.com/carbon-design-system/carbon/issues/14139), we can take a look and see if it is possible to refactor the Pagination
to use Dropdown
. For right now, however, we don't plan on making any changes to the behavior.
Package
@carbon/react
Browser
Chrome
Operating System
MacOS
Package version
v11
React version
v1.38
Automated testing tool and ruleset
n/a
Assistive technology
No response
Description
WCAG 2.1 Violation
WCAG 2.2.1 Keyboard
Reproduction/example
n/a
Steps to reproduce
[Component live demo]()
Code of Conduct