[material-ui][Dialog] Pressing enter to close dialog causes partial focus animation of open dialog button
Open
@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:
- Go to the MUI Dialog docs page -> Basic dialog section
- Click "Open simple dialog" and move mouse away
- Hit enter to "click" the auto-focused "Add account" button
- The modal will close, and the "open simple dialog" button will be focused with half the on-click animation triggered
- It will stay that way until you hover over it and move mouse out
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.