Skip to content
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

[fields] Fix input refocusing after clearing a value #12587

Merged
merged 4 commits into from
Mar 28, 2024

Conversation

LukasTy
Copy link
Member

@LukasTy LukasTy commented Mar 28, 2024

Fixes #12574

  • Add e2e tests asserting that current focusing behavior after clearing value is broken
  • Call isFieldFocused function instead of only checking it's existence

@LukasTy LukasTy added regression A bug, but worse component: pickers This is the name of the generic UI component, not the React module! feature: Keyboard editing Related to the pickers keyboard edition labels Mar 28, 2024
@LukasTy LukasTy self-assigned this Mar 28, 2024
@mui-bot
Copy link

mui-bot commented Mar 28, 2024

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

Generated by 🚫 dangerJS against 842472b


if (!interactions.isFieldFocused) {
if (!interactions.isFieldFocused()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤦 🤦 🤦 🤦 🤦 🤦 🤦 🤦

Thanks for fixing it

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P.S. Didn't want to risk it again, that's why I took a bit longer than expected. 🙈
At first, I tried tailoring a unit test—which proved to be nearly impossible to achieve reliably.
Then, I resorted to writing an e2e test, which also posed challenges due to Firefox's getSelection behavior... 🙈 🤷

@LukasTy LukasTy enabled auto-merge (squash) March 28, 2024 08:03
@LukasTy LukasTy merged commit dcb6582 into mui:master Mar 28, 2024
17 checks passed
@LukasTy LukasTy deleted the fix-field-clearable-refocus branch March 28, 2024 09:09
DungTiger pushed a commit to DungTiger/mui-x that referenced this pull request Jul 23, 2024
thomasmoon pushed a commit to thomasmoon/mui-x that referenced this pull request Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: pickers This is the name of the generic UI component, not the React module! feature: Keyboard editing Related to the pickers keyboard edition regression A bug, but worse
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[fields] The input loses focus after pressing on clear button
3 participants