Skip to content

[pickers] Avoid DigitalClock stealing focus from a Picker open button on close #17686

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

LukasTy
Copy link
Member

@LukasTy LukasTy commented May 5, 2025

Address this: https://github.com/mui/mui-x/pull/14508/files#diff-d34f269f8eebce25782ac5211d76a046669733a73ba6a56ca97685c310f6ed01R194

Currently, the focus is not returned to the Picker open button on MobileTimeRangePicker.

The reason for this issue is the fact that DigitalClock and MultiSectionDigitalClock "steals" the focus from the Dialog behavior too early.
Changing the effect to a layoutEffect avoids this problem.

P.S. I couldn't reproduce this problem even on e2e tests. 🙈
So, kudos to vitest as only it could reliably fail here...


Also address this "brain-fart": #17517 (comment)

@LukasTy LukasTy added type: bug A bug or unintended behavior in the components. plan: Pro Impact at least one Pro user scope: pickers Changes or issues related to the pickers product labels May 5, 2025
@LukasTy LukasTy self-assigned this May 5, 2025
@mui-bot
Copy link

mui-bot commented May 5, 2025

Deploy preview: https://deploy-preview-17686--material-ui-x.netlify.app/

Generated by 🚫 dangerJS against 0ab26b0

@LukasTy LukasTy marked this pull request as ready for review May 5, 2025 14:27
@LukasTy LukasTy merged commit f046ebe into mui:master May 5, 2025
21 checks passed
@LukasTy LukasTy deleted the fix-mobile-time-range-picker-focus-back-open-button branch May 5, 2025 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plan: Pro Impact at least one Pro user scope: pickers Changes or issues related to the pickers product type: bug A bug or unintended behavior in the components.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants