Skip to content

[material-ui][Dialog] Should not close until the IME is cancelled#39713

Merged
mj12albert merged 1 commit intomui:masterfrom
megos:fix-dialog-wait-until-ime-settled
Nov 6, 2023
Merged

[material-ui][Dialog] Should not close until the IME is cancelled#39713
mj12albert merged 1 commit intomui:masterfrom
megos:fix-dialog-wait-until-ime-settled

Conversation

@megos
Copy link
Contributor

@megos megos commented Nov 2, 2023

We use the escape key to cancel IME input.
This PR changed a dialog that keeps open when you cancel IME input in a dialog with the escape key.

This is similar to #19435

@mui-bot
Copy link

mui-bot commented Nov 2, 2023

Netlify deploy preview

https://deploy-preview-39713--material-ui.netlify.app/

Bundle size report

Details of bundle changes (Toolpad)
Details of bundle changes

Generated by 🚫 dangerJS against 22e5a42

@mj12albert mj12albert requested a review from mnajdova November 2, 2023 08:10
@mj12albert mj12albert added scope: dialog Changes related to the dialog. package: material-ui labels Nov 2, 2023
@mj12albert mj12albert requested review from DiegoAndai and siriwatknp and removed request for mnajdova November 2, 2023 08:11
Copy link
Member

@DiegoAndai DiegoAndai left a comment

Choose a reason for hiding this comment

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

Hey @megos, thanks for working on this 🎉

I left a question:

if (event.key !== 'Escape' || !isTopModal()) {
if (
event.key !== 'Escape' ||
event.which === 229 || // Wait until IME is settled.
Copy link
Member

@DiegoAndai DiegoAndai Nov 3, 2023

Choose a reason for hiding this comment

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

.which is deprecated. Could we use .isComposing instead?

Copy link
Member

Choose a reason for hiding this comment

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

FYI I found in an old issue about isComposing with an odd behavior in macOS Safari: #19435 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As per the issue comment above, it needs to use which instead of isComposing for Safari.
This behavior is not fixed on the latest (17.1) Safari version.

@mj12albert mj12albert self-assigned this Nov 6, 2023
Copy link
Member

@mj12albert mj12albert left a comment

Choose a reason for hiding this comment

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

Looks good ~ appreciate that you added a test as well ✨ @megos

fireEvent.keyDown(textbox, { key: 'Esc', keyCode: 229 });
expect(onClose.callCount).to.equal(0);

fireEvent.keyDown(textbox, { key: 'Esc' });
Copy link
Member

Choose a reason for hiding this comment

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

This looks off, fixing it in #43961.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: dialog Changes related to the dialog. type: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants