-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Navigation Link: Add opensInNewTab
to resetAll
#70717
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
Navigation Link: Add opensInNewTab
to resetAll
#70717
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. |
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 catch, @Infinite-Null!
@@ -187,6 +187,7 @@ function Controls( { attributes, setAttributes, setIsLabelFieldFocused } ) { | |||
url: '', | |||
description: '', | |||
rel: '', | |||
opensInNewTab: 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.
Good catch 👍
The issue is that this approach is already not sustainable. Any other props that are added probably will get missed from this list and the same bug will reoccur.
Not blocking on this PR landing but something to consider.
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.
The issue is that this approach is already not sustainable. Any other props that are added probably will get missed from this list and the same bug will reoccur.
That's kind of the unfortunate deal with attributes. A developer has to cover all the corners when adding a new attribute.
Co-authored-by: Infinite-Null <ankitkumarshah@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: getdave <get_dave@git.wordpress.org>
What?
Follow up of: #67262
Add
opensInNewTab: false
to the default attributes when resetting navigation link fields.Why?
This PR ensures that when navigation link attributes are reset, the
opensInNewTab
attribute is also properly reset to its default value offalse
.How?
Added
opensInNewTab: false
to the object passed tosetAttributes()
in the reset functionality within the Controls component of the navigation-link block. This ensures all navigation link attributes are consistently reset to their default values when the clear action is triggered.Testing Instructions
reset all
functionality.Screencast
Screen.Recording.2025-07-14.at.5.49.20.PM.mov