mui / mui/material-ui

[Select] calling `.focus()` on the ref does not focus the component

Open
#44,197 4 comments 0 reactions 1 assignee View on GitHub

Nobody has claimed this yet.

scope: select
Dominant language
JavaScript
Stars
99.1k
Forks
32.5k
Avg merge
2d 17h
Merged PRs (30d)
106

Description

Steps to reproduce

https://mui.com/material-ui/react-select/
document.getElementById('demo-simple-select').focus()

Current behavior

If you call .focus() on any of the elments that are rendered by MuiSelect or on the refs element it will not focus the select or it will only visually focus it, but pressing space to open the menu will not work (and instead scrolls the page down).

Expected behavior

That I can call .focus on the ref or an element to focus the select or that there is an alternative way documented / implemented
There is nothing document about this behavior in the docs.

Context

Having a way to programmatically focus an select

Your environment

Mui@6, Chrome

Search keywords: MuiSelect

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.