mui / mui/material-ui

[material-ui][Dialog] Pressing enter to close dialog causes partial focus animation of open dialog button

Open
#39,614 2 comments 1 reaction 1 assignee View on GitHub

@siriwatknp is already working on this.

Since Oct 26, 2023.

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
Steps to reproduce 🕹

Link to live example: MUI Dialog Docs -> Basic Dialog

Steps:

  1. Go to the MUI Dialog docs page -> Basic dialog section
  2. Click "Open simple dialog" and move mouse away
  3. Hit enter to "click" the auto-focused "Add account" button
  4. The modal will close, and the "open simple dialog" button will be focused with half the on-click animation triggered
  5. It will stay that way until you hover over it and move mouse out

mui-dialog

Current behavior 😯

When a dialog closes as a result of hitting enter, the underlying button that opened it gets a frozen partial animation as if it's just been clicked.

Expected behavior 🤔

The button should not partially animate.

Context 🔦

In my own project, I'm using a similar simple dialog with a form on it. When the user presses enter to submit the form, the UX looks strange due to this issue.
I'd like to fix this UX glitch.

Your environment 🌎
npx @mui/envinfo
  System:
    OS: Windows 10 10.0.19045
  Binaries:
    Node: 18.16.1 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 9.5.1 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 118.0.5993.89
    Edge: Spartan (44.19041.3570.0), Chromium (118.0.2088.61)
  npmPackages:
    @emotion/react: latest => 11.11.1 
    @emotion/styled: latest => 11.11.0 
    @mui/base:  5.0.0-beta.17 
    @mui/core-downloads-tracker:  5.14.11 
    @mui/icons-material: latest => 5.14.11 
    @mui/material: latest => 5.14.11 
    @mui/private-theming:  5.14.11 
    @mui/styled-engine:  5.14.11 
    @mui/system:  5.14.11 
    @mui/types:  7.2.4 
    @mui/utils:  5.14.11 
    @mui/x-data-grid: ^6.14.0 => 6.15.0 
    @types/react: latest => 18.2.23 
    react: ^18.2.0 => 18.2.0 
    react-dom: ^18.2.0 => 18.2.0 
    typescript: latest => 5.2.2 

Browser: Chrome Version 118.0.5993.89 (Official Build) (64-bit) (on Windows 10)

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.