-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Fix Modal’s dismiss effect in StrictMode #64075
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Size Change: +10 B (0%) Total Size: 1.76 MB
ℹ️ View Unchanged
|
@@ -89,8 +89,7 @@ function useEditorCommandLoader() { | |||
name: 'core/open-shortcut-help', | |||
label: __( 'Keyboard shortcuts' ), | |||
icon: keyboard, | |||
callback: ( { close } ) => { | |||
close(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to keep the Command Palette modal open alongside the shortcuts and preferences modal? Most of the commands I checked call the close callback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Non-nested) Modal’s already can’t be open alongside each other. It doesn’t hurt anything to keep calling the close
callback but I figured why not remove it now that the malfunction it works around is fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling close()
here is actually a good idea, because the command palette modal closes itself explicitly.
Otherwise it's auto-closed by the newly opened modal: they are at the same context level, they are not nested, so only one can be open.
What?
A bug fix and follow up to #64019 which worked around the issue #64004 where in StrictMode an effect can force a Modal to dismiss itself immediately.
Why?
The effect to dismiss other Modal’s should work properly whether or not StrictMode is active.
How?
Testing Instructions
WP_DEBUG = true
andSCRIPT_DEBUG = true
.Testing Instructions for Keyboard
Screenshots or screencast
modal-dismissage.mp4