-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Link Control: Fix focus handlers in development mode #62141
Conversation
Size Change: +9 B (0%) Total Size: 1.74 MB
ℹ️ View Unchanged
|
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.
Ah, so it complains about the lack of cleanup function right?
@ellatrix, yes, it's a similar scenario. Here's the cycle:
The last two runs only happen in development mode to ensure that effect callbacks are pure. I used separate effect because effect also reacts to state change, and we don't want that to affect the TL;DR: If the component tracks the mounting state, it should also reset it on unmount. |
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. |
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.
Looks good! Thanks for the fix.
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: ellatrix <ellatrix@git.wordpress.org> Co-authored-by: jeryj <jeryj@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: ellatrix <ellatrix@git.wordpress.org> Co-authored-by: jeryj <jeryj@git.wordpress.org>
What?
Fixes #62089.
Related #61943.
PR fixes the
LinkControl
component's auto-focus handler and allows users to edit the linked text in development mode when the popover is rendered.Why?
isMounting
is true.isMounting
is false, and focus logic is invoked.How?
Move the component's
isMounting
state synchronization into a separate effect and add a cleanup method.Testing Instructions
The following e2e test should pass in development mode, and CI checks should be green. See the original issue for enabling the dev mode.
Testing Instructions for Keyboard
Same.