-
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 Component: Search Control in Menu Titles #25315
Merged
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
2649516
Move the menu title in its own component
Copons 0159b72
Introduce basic items filtering
Copons 460f844
Update the style
Copons 7fde9a1
Sort rebase issues
Copons a73ed9b
Add a _isVisible property to the navigation tree items
Copons 52f4bbf
Fix improper merge
Copons 502a799
Update menu title styles
Copons bb60064
Restructure and fix animation
Copons ddf3165
Remove search field decoration
Copons 6acdb76
Make the search optionally controlled from the outside
Copons cc82f17
Move the search into its own component to useRef
Copons d5aaf2f
Simplify the menu components interfaces
Copons f94dbf7
Add a visually hidden label
Copons 3a7e083
Update search icon colors
Copons 9d8c43b
Close search on ESC
Copons 96be998
Focus search button on search close
Copons cf5e7d1
Make items navigable via up/down arrows
Copons b46eb78
Clarify use of title by search
Copons c4c947e
Update the story
Copons 34a0ce5
Add aria labels
Copons 1e1daf3
Simplify CSS
Copons b51edcd
Use space function instead of hardcoded values
Copons f40f9ac
Announce the number of search results
Copons 8b90be6
Add group roles and labels
Copons 5a63a2e
Add more aria-labelledby
Copons 642332d
Test without listitem role
Copons 25f33f9
Add an internal unique ID to NavigationItem instead of using the opti…
Copons 792f368
Add a group context to handle empty groups
Copons 15a9fe6
Remove tooltips (but keep labels)
Copons 4dc2c3b
Move the search focus delay into a constant
Copons 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export const ROOT_MENU = 'root'; | ||
export const SEARCH_FOCUS_DELAY = 100; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { createContext, useContext } from '@wordpress/element'; | ||
|
||
export const NavigationGroupContext = createContext( { group: undefined } ); | ||
|
||
export const useNavigationGroupContext = () => | ||
useContext( NavigationGroupContext ); |
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
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.
I think this is fine for now, but I think we'll need to think of how to search from external dataset whose items are not completely included in navigation menu? For example, we might have Pages navigation with thousands of items, and we might not want to render them all within the menu.
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.
There is an
onSearch
prop that can be used to handle this kinds of things, e.g. to perform an actual database search.(At least that's the idea, but I haven't tested it in a real-life scenario)