-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Navigation Link: Fix URL deletion in Inspector Controls #70749
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
Conversation
Size Change: +63 B (0%) Total Size: 1.89 MB
ℹ️ View Unchanged
|
Flaky tests detected in 7cf25a6. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/16364021649
|
d4d8bcb
to
7cf25a6
Compare
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.
This works as advertised and is a great improvement :)
The code also looks good to me 👍 Thanks for working on this :)
Thanks for testing, @fabiankaegy! It appears that unit tests have started failing (#68143). I need to investigate this issue, and then I will merge the changes. |
// Defer the updateAttributes call to ensure entity connection isn't severed by accident. | ||
updateAttributes( | ||
{ url: urlValue }, | ||
{ url: ! url ? lastURLRef.current : url }, | ||
setAttributes, | ||
attributes | ||
{ ...attributes, url: lastURLRef.current } | ||
); | ||
setIsEditingControl( false ); |
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.
@getdave, what do you think about this?
The connection is severed after the first change on the trunk. This delays actual processing logic until the user is "done" editing, or if they have changed their mind.
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.
Good spot and I think we don't have much choice on this one.
I'm surprised we don't already just use internal state (useState
) to manage the value and then only "submit" it on blur.
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.
This also works, so decided to go without separate internal state.
@fabiankaegy, @getdave, can I get a final approval? |
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.
Still works as advertised:)
) * Navigation Link: Fix URL deletion in Inspector Controls * Fix unit tests * Defer should sever entity link logic Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: fabiankaegy <fabiankaegy@git.wordpress.org> Co-authored-by: getdave <get_dave@git.wordpress.org> Co-authored-by: scruffian <scruffian@git.wordpress.org> Co-authored-by: Robertght <robertghetau@git.wordpress.org>
) * Navigation Link: Fix URL deletion in Inspector Controls * Fix unit tests * Defer should sever entity link logic Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: fabiankaegy <fabiankaegy@git.wordpress.org> Co-authored-by: getdave <get_dave@git.wordpress.org> Co-authored-by: scruffian <scruffian@git.wordpress.org> Co-authored-by: Robertght <robertghetau@git.wordpress.org>
What?
Closes #60758.
PR fixes a bug for the Navigation Link control and allows deleting the last character in the URL control.
Why?
The user should be able to modify the URL entirely via the inspector controls.
How?
Reuse workaround for
label
controls.Testing Instructions
Testing Instructions for Keyboard
Same.
Screenshots or screencast
CleanShot.2025-07-17.at.07.54.13.mp4