mui / mui/material-ui

[Dialog] Focus lost when opening a dialog from a menu using the keyboard

Open
#33,237 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Duplicates
  • I have searched the existing issues
Latest version
  • I have tested the latest version
Current behavior 😯

Using a keyboard, opening up a dialog from the menu and then closing it , the focus returns to the top of the page and doesn't remain on the menu

Expected behavior 🤔

Using a keyboard, opening up a dialog from the menu and then close it, the focus remains on the menu

Steps to reproduce 🕹

Steps:

  1. User goes to https://codesandbox.io/s/gifted-phoebe-lsk3m6?file=/src/Test.js in Chrome, Firefox or Edge
  2. Using a keyboard only, open up the dialog from the menu and then close it
  3. Observe now where the focus is
Context 🔦

This fails accessibility as the user's focus returns to the top of the page

Your environment 🌎

System:
@emotion/styled: ^11.6.0 => 11.6.0
@mui/base: 5.0.0-alpha.59
@mui/icons-material: ^5.2.1 => 5.2.1
@mui/lab: ^5.0.0-alpha.59 => 5.0.0-alpha.59
@mui/material: ^5.2.3 => 5.2.3
@mui/private-theming: 5.2.3
@mui/styled-engine: 5.2.0
@mui/system: 5.2.3
@mui/types: 7.1.0
@mui/utils: 5.2.3
@types/react: 16.9.51
react: ^17.0.2 => 17.0.2
react-dom: ^17.0.2 => 17.0.2

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.

Research direction

Start with the CodeSandbox reproduction at https://codesandbox.io/s/gifted-phoebe-lsk3m6?file=/src/Test.js and reproduce the dialog flow using only the keyboard in Chrome, Firefox, or Edge. Trace the menu and dialog focus behavior; done means closing the dialog returns focus to the menu rather than the top of the page.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
accessibility, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.