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

[material-ui][Select] No visible highlight when focus is on another Element #39497

Open
2 tasks done
supidupicoder2 opened this issue Oct 18, 2023 · 8 comments
Open
2 tasks done
Assignees
Labels
bug 🐛 Something doesn't work component: select This is the name of the generic UI component, not the React module! on hold There is a blocker, we need to wait package: material-ui Specific to @mui/material

Comments

@supidupicoder2
Copy link

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Steps to reproduce 🕹

Link to live example:
https://react-tgv59j-vsvdvu.stackblitz.io
chrome_33BRQbhtul
Steps:

  1. Open link
  2. Click on dropdown
  3. Preselection for "Twenty" is visible
  4. If i hit "T" on the keyboard, the selection goes to the next option
  5. Now eiher click the button below, or click the button, hold the left mouse cursor, drag it somewhere else on the whitespace, and release it
  6. If you click the dropdown again, nothing is preselected, at least visibly
  7. If you hit "T", the second element is instantly selected

ALSO:
If you hit "Enter" in Step 6 without selecting any other element, "Twenty" will be selected. So i assume it is preselected, but not visibly.

Current behavior 😯

After clicking the button, the preselection is not visible anymore.

Expected behavior 🤔

I would either expect "Twenty" already being visibly preselected in Step 6, or the Keyboard Action of Step 7 selecting the first Element.

Context 🔦

I currently have an issuew with keyboard controlls sometimes not working for some dropdowns in my application. When the keyboard controlls do not work, there is also nothing preselected.
I assume this is part of the issue.

Your environment 🌎

See stackblitz live example environment.
Browser was Chrome.

@supidupicoder2 supidupicoder2 added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Oct 18, 2023
@danilo-leal danilo-leal changed the title MUI Select: No visible preselection when focus is on another Element [material-ui][Select] No visible preselection when focus is on another Element Oct 18, 2023
@danilo-leal danilo-leal added component: select This is the name of the generic UI component, not the React module! package: material-ui Specific to @mui/material labels Oct 18, 2023
@DiegoAndai DiegoAndai self-assigned this Oct 18, 2023
@DiegoAndai DiegoAndai added bug 🐛 Something doesn't work ready to take Help wanted. Guidance available. There is a high chance the change will be accepted and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Oct 27, 2023
@DiegoAndai
Copy link
Member

Hey @supidupicoder2, thanks for the report!

This seems like a bug. I can repro on the docs:

  1. Click another element so it gains focus
  2. Open Select
  3. No visible highlight, but the highlight is "working" as keyboard navigation works: after pressing the ArrowDown key, the highlight kicks in again
Screen.Recording.2023-10-27.at.16.02.03.mov

@JeevaRamanathan
Copy link

Hi @DiegoAndai, I noticed that when the user focuses on another element before opening the select dropdown menu, also has no preselection.

i.e.

  1. Click on button first
  2. Open drop down
  3. It has no preselection

Given that there is no default value selected, it is expected for the basic dropdown menu to be preselected or not?

@DiegoAndai DiegoAndai changed the title [material-ui][Select] No visible preselection when focus is on another Element [material-ui][Select] No visible highlight when focus is on another Element Oct 30, 2023
@DiegoAndai
Copy link
Member

@JeevaRamanathan, for the Menu component, this is expected: there's no "default" highlight on the first element.

For the Select component, it's not expected: the first element should be highlighted if no value is selected. That is what this issue is pointing out.

@DarhkVoyd
Copy link
Contributor

@DiegoAndai Should I take this?

@DiegoAndai
Copy link
Member

@DarhkVoyd please! go ahead 😊
Let me know if there's anything I can help with

@DarhkVoyd
Copy link
Contributor

Hi @DiegoAndai. Apologies for the delay, I'm quite occupied with my college project and might not be able to work on this issue promptly. If it's urgent, kindly reassign it to someone else. Thanks for your understanding.

@DarhkVoyd
Copy link
Contributor

@DiegoAndai Hey, I'm back on this, will provide an update to you soon.

@DiegoAndai DiegoAndai added on hold There is a blocker, we need to wait and removed ready to take Help wanted. Guidance available. There is a high chance the change will be accepted labels Dec 20, 2023
@DiegoAndai DiegoAndai added this to the Material UI: v7 draft milestone Dec 20, 2023
@DiegoAndai
Copy link
Member

This will be fixed when we refactor the Select component to use Base UI's hooks: #40210

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: select This is the name of the generic UI component, not the React module! on hold There is a blocker, we need to wait package: material-ui Specific to @mui/material
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants