Skip to content
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

[Select] Keyboard navigation breaks when first child is ListSubheader #20448

Closed
2 tasks done
petermikitsh opened this issue Apr 7, 2020 · 6 comments
Closed
2 tasks done
Labels
component: select This is the name of the generic UI component, not the React module! support: Stack Overflow Please ask the community on Stack Overflow

Comments

@petermikitsh
Copy link
Contributor

When the first child of a Select component is ListSubheader, you must press tab before up/down arrow key functionality works.

  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

tab key press is necessary.

Expected Behavior 🤔

tab keypress should not be necessary.

Steps to Reproduce 🕹

Steps:

  1. Go to https://codesandbox.io/s/loving-knuth-e5ovy?file=/src/index.js
  2. Click in the preview area
  3. Press tab
  4. Press return
  5. Observe that up/down arrow keys have no effect
  6. Press tab
  7. Observe up/down arrow keys now work

Fix criteria: Step 6 is no longer necessary.

Context 🔦

Your Environment 🌎

Tech Version
Material-UI v4.9.9
React v16.13.1
Browser Chrome
TypeScript
etc.
@eps1lon
Copy link
Member

eps1lon commented Apr 7, 2020

A ListSubheader doesn't make much sense here. You'd need an abstraction that tells the Select that the iption is disabled. Direct children of Select need to be options.

@eps1lon eps1lon added the support: Stack Overflow Please ask the community on Stack Overflow label Apr 7, 2020
@support
Copy link

support bot commented Apr 7, 2020

👋 Thanks for using Material-UI!

We use GitHub issues exclusively as a bug and feature requests tracker, however,
this issue appears to be a support request.

For support, please check out https://material-ui.com/getting-started/support/. Thanks!

If you have a question on StackOverflow, you are welcome to link to it here, it might help others.
If your issue is subsequently confirmed as a bug, and the report follows the issue template, it can be reopened.

@support support bot closed this as completed Apr 7, 2020
@oliviertassinari
Copy link
Member

oliviertassinari commented Apr 7, 2020

@petermikitsh Please see #18200. I understand you are coming from our select group demo, we need to work on it.

@petermikitsh
Copy link
Contributor Author

@oliviertassinari How should I implement this, in a way where the select input with headers is accessibility-friendly?

@oliviertassinari
Copy link
Member

I have no idea, did you look into the problem?

@petermikitsh
Copy link
Contributor Author

petermikitsh commented Apr 7, 2020

@oliviertassinari using option and optgroup while setting native={true} on the Select works for accessibility. That's the first example here: https://material-ui.com/components/selects/#grouping

I made another example to demo keyboard navigation works properly when using native with the first element being an optgroup (the native equivalent of a ListSubheader): https://codesandbox.io/s/exciting-water-ki7eu?file=/src/index.js

@oliviertassinari oliviertassinari added the component: select This is the name of the generic UI component, not the React module! label May 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: select This is the name of the generic UI component, not the React module! support: Stack Overflow Please ask the community on Stack Overflow
Projects
None yet
Development

No branches or pull requests

3 participants