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 section pasting #11447

Merged
merged 8 commits into from
Dec 19, 2023
Merged

[fields] Fix section pasting #11447

merged 8 commits into from
Dec 19, 2023

Conversation

LukasTy
Copy link
Member

@LukasTy LukasTy commented Dec 18, 2023

Fixes #10880

Currently, when we detect a section paste, we just return from the paste handler, thus handing the execution to a regular input change handler, which fails on non-chromium browsers, because on them the event.data contains the pasted value.

Changed the logic to update a section value with the pasted value and call preventDefault to avoid triggering the input change handler.

Note

I tried hard to make the e2e test work, but sadly, headless and CI don't play along with Clipboard API nicely. Left only the firefox test functional. 🙈

  • Add e2e test asserting correct section copy and paste behavior
    • include an assertion of reset query resetting
  • Add unit test asserting correct section paste behavior

@LukasTy LukasTy added bug 🐛 Something doesn't work 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 Dec 18, 2023
@LukasTy LukasTy self-assigned this Dec 18, 2023
@mui-bot
Copy link

mui-bot commented Dec 18, 2023

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

Generated by 🚫 dangerJS against 85fe162

Copy link
Member

@flaviendelangle flaviendelangle left a comment

Choose a reason for hiding this comment

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

Make total sense, a lot less risky 👌

@LukasTy
Copy link
Member Author

LukasTy commented Dec 19, 2023

Make total sense, a lot less risky 👌

Would you agree that we should also include it in v6? 🤔

@flaviendelangle
Copy link
Member

Sure, it's a bug fix that is super easy to port 👍

@LukasTy LukasTy added the needs cherry-pick The PR should be cherry-picked to master after merge label Dec 19, 2023
@LukasTy LukasTy merged commit 5a861e8 into mui:next Dec 19, 2023
18 checks passed
@LukasTy LukasTy deleted the fix-section-pasting branch December 19, 2023 22:32
github-actions bot pushed a commit that referenced this pull request Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: pickers This is the name of the generic UI component, not the React module! feature: Keyboard editing Related to the pickers keyboard edition needs cherry-pick The PR should be cherry-picked to master after merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[fields] Pasting in DateField on Safari can cause inconsistent UI state
3 participants