-
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
Components: Update Navigator
components — Tracking Issue
#34907
Comments
A brief recap of what's happened so far:
One of the most recent points of conversation has been about having the Navigation components touching the browser's URL. In https://github.com/WordPress/gutenberg/pull/32923/files#r710975447 @youknowriad has argued that
I personally believe that we should aim at having a complete set of Routing capabilities powering the Navigation components. The prototype from ItsJonQ/g2#293 features a Routing system heavily inspired by
With a feature-full router under the hood, we would be able to pick and choose which type of "routing" (e.g. in-memory, URL-based...) we want to expose from |
Regarding routing, Q's original feedback on the current In particular, he describes how the requirements for the component align very well with the requirements for a router. The challenge with using React Router directly is that its state management and shared context may block using multiple instances of the router for different sub-sections of UI. @ockham and @sirreal chimed into urge further exploration of directly using React Router, though: I agree that if we're integrating a routing API, we ought to explore using React Router directly further. Beyond the routing concerns, though, I think the biggest issue with the current components is that they're designed particularly for navigation menus whereas the structure proposed in G2's This issue from G2 goes over some of these style-related requirements:
|
Navigator
components — Tracking Issue
I've made #35310 as an example of fixing that without worrying about it within the component for now. Don't let the number of changes throw you off. The last two commits are extraneous to the scrollbar fix. They're outdated CSS cleanup and alignment improvement for the Post Editor’s preferences modal. I may just break them off for a separate PR. In addition to that, I wanted to suggest we improve the animation in the component by having the exiting screen also animate. Apparently, it was that way in the g2 repo and we've got some dregs of that still leftover in ours. I've got #35312 open that restores the framer-motion exit animations. Also, because I was curious about performance differences there's #35311 which does the same but with CSS driven animation. |
Thank you @stokesman for taking the time to contribute to the
|
This is an overview issue to track all of the tasks necessary to introduce and refine the set of
Navigator
components, especially in the context of using it in the updated Global Styles Sidebar.As discussed in numerous previous issues and PRs (#34885, #32923, #34904), the current set of Navigation components feels limited, as it is quite tailored to representing nested menus, and has a quite imperative style.
For these reasons, we would like to replace the current set of
Navigation
components with a new set of components (for now calledNavigator
), focused on offering a simple set of APIs to navigate through different "screens" by simply specifying the current screen'spath
in a simple, declarative way. This new set of components should not be rendering any opinionated pieces of UI.Improve the component
Navigator
components, and use them in the new, experimental version of the Global Styles sidebar (Add new Navigator components and use them in the global styles sidebar #34904)Navigator*
folder structure, renameNavigator
toNavigatorProvider
#35160)Navigator
component (Components: add tests forNavigator*
#35163)Navigator
components to TypeScript and hook into the Context System (Navigator
: refactor to TypeScript #35214)Navigator
: hide scrollbars while animating #35317)history
and thus enabling back/forward functionalityNavigator
: add basic history support, enable advanced focus restoration #37223Navigator
component and the client-side router in side editor #37355Adoption strategy
This is a potential strategy, although it needs to be validated:
Navigation
components to use the newNavigator
components under the hoodNavigation
with the newNavigator
components (including all known external projects, like Woo)The text was updated successfully, but these errors were encountered: