question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Select] - First options receives .Mui-focusVisible always

See original GitHub issue
  • 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 😯

There is some issue with :focus-visible for Select. For the first time when there is no value selected .Mui-focusVisible class is getting applied to the first item in a list. This is not the case for the Menu component though. Also, this happens only in Chrome.

Expected Behavior 🤔

Same behaviour as the Menu component has.

Steps to Reproduce 🕹

Two components side by side:https://codesandbox.io/s/material-ui-issue-forked-udm04?file=/src/Demo.js

Steps:

Case 1:

  1. Open Select via mouse click
  2. The first item is highlighted with a red border meaning the focusVisible class was added

Case 2:

  1. Refresh a page
  2. Open Menu via mouse click everything works as expected

Context 🔦

Want have focus applied on Select only when it was focused with a keyboard. The options should also stay without focus if the keyboard wasn’t used

Your Environment 🌎

Tech Version
Material-UI v5.0.0.alpha.17
React 17
Browser Chrome
TypeScript
etc.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
CarlosAmaralcommented, Jul 13, 2022

This is still a problem btw. Anyway to fix this?

0reactions
hiroki0404508commented, Nov 29, 2022

I also encountered the same event. I think the environment is the same as @orest22. Are there any plans to fix this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Select] - First options receives .Mui-focusVisible always #23747
Open Menu via mouse click everything works as expected. Context. Want have focus applied on Select only when it was focused with a...
Read more >
How to avoid Material UI Select focus when option is chosen?
So if your problem is the focus after the value selection, try this: 1) Import MuiThemeProvider and createMuiTheme on your component:
Read more >
How to set the default value for an HTML <select> element
The default value of the select element can be set by using the 'selected' attribute on the required option. This is a boolean...
Read more >
Form Select | Components - BootstrapVue
Generate your select options by passing an array or object to the options props: ... text: 'This is First option' }, { value:...
Read more >
How do I get the text value of a selected option?
Select elements typically have two values that you want to access. First there's the value to be sent to the server, which is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found