-
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
Navigation: Surface menu name
in the List View
next to the Navigation block
#68446
Merged
Mamaduka
merged 12 commits into
WordPress:trunk
from
yogeshbhutkar:68177/add-navigation-block-label
Jan 13, 2025
Merged
Changes from 7 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
54b9364
Add menuTitle attribute to navigation block and update label display
yogeshbhutkar 9e5240d
Refactor: label updation logic to use refs
yogeshbhutkar 453a690
Update navigation title rendering to include block title and decode H…
yogeshbhutkar 1273df0
Refactor: use `getEditedEntityRecord` instead of `getEntityRecord`
yogeshbhutkar 1706ef7
Test Cases: Fix failing tests
yogeshbhutkar 68dee39
Refactor: enhance __experimentalLabel logic to handle end cases
yogeshbhutkar 77e23ec
Refactor: simplify navigation title check logic
yogeshbhutkar 9c254e4
Refactor: simplify navigation title rendering logic
yogeshbhutkar d7faa4a
Test case: fix failing tests
yogeshbhutkar a9fcb8b
Refactor: remove `context` limitations
yogeshbhutkar 32824a2
Test Cases: update failing test cases
yogeshbhutkar 9653966
Refactor: replace `getByLabel` to `getByRole`
yogeshbhutkar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
navigation.title === metadata.title
condition will never betrue
. The Navigation block has its renaming system and disabledrenaming
support.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.
I was attempting to achieve this. It works fine when both the texts are
Navigation
but if the label is changed using the following snippet, it fails: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.
@Mamaduka I think this is for the case when the Navigation menu is named
Navigation
(which is the default name).Because we don't want the label to read
Navigation (Navigation)
So that is what this comparison is for
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.
I feel we can use the runtime title for navigation block:
This way, even if the filter updates the title, we can accommodate for the changes.
Like, if the title becomes My Navigation, then
My Navigation (My Navigation)
=>My Navigation
case will be covered. However, the above condition works just fine if we want to checkNavigation
itself, as the name is relatively static. I'm not sure if we should accommodate for the title changes on the fly (via filter) for this one. If so, this is the way to go.What are your thoughts?
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.
I think we should just drop the block title from here and only display the navigation title. No other block (Template Part, Synced Pattern) does this. Let's keep the behavior consistent.
@t-hamano, also suggested the same: #68446 (comment).
Let's just use this logic. What do you think?
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 @Mamaduka. The icon can convey the meaning of the block IMO.
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.
That's the current convention in the List View, and the Block Card in the right sidebar displays a badge with the original block title.