-
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
Add ability to open the editor on the selected post on navigation. #47387
Add ability to open the editor on the selected post on navigation. #47387
Conversation
Size Change: +92 B (0%) Total Size: 1.31 MB
ℹ️ View Unchanged
|
@@ -17,7 +17,7 @@ export default function SidebarNavigationScreenNavigationMenus() { | |||
title={ __( 'Navigation' ) } | |||
content={ | |||
<div className="edit-site-sidebar-navigation-screen-navigation-menus"> | |||
<NavigationInspector /> | |||
<NavigationInspector enableNavigation={ true } /> |
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 is a weird way to implement this feature. Wouldn't it be better to have an onSelect
here instead. It would keep the OffCanvasEditor
independent from the "url"/"site editor".
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.
OffCanvasEditor independent from the "url"/"site editor"
OffCanvasEditor was already independent. We are not changing anything of OffCanvasEditor in this PR. NavigationInspector is a site editor component used just on the site editor, but your suggestion is great, and I applied it to NavigationInspector, which now receives an onSelect.
if ( history && postType && postId ) { | ||
history.push( { postType, postId } ); | ||
if ( selectedBlock ) { | ||
onSelect( selectedBlock ); |
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.
Is there a way to call this in onClick
events instead. Could the onSelect
prop be passed down to NavigationMenu
...?
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.
Hi @youknowriad, I followed this suggestion, and now onSelect is called on the click event instead of relying on an effect.
4b0fc28
to
d3acf8c
Compare
Flaky tests detected in f5213e0. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4079103296
|
88b9c7e
to
d3acf8c
Compare
Squashed commits: [d32556f] Add ability to open the editor on the selected post on navigation.
d3acf8c
to
f5213e0
Compare
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.
LGTM. I noticed that when we select a page/post there's a small delay (slow connections) where you don't see any change and you don't have feedback. I wonder if we could show the CanvasSpinner when it's the case or give some other feedback.
Would love a review from @jasmussen or @jameskoster
Nice work, yes, let's land this. I would agree, diming the iframe ever so slightly and showing a spinner would be useful. Probably not a blocker for this one, but a nice enhancement. Note that I would create this spinner in a "optimistic" way. That is, only show it after, say, 600ms if the page hasn't already loaded. Separately, one idea that was brought up in conversation recently was that instead of clicking a navigation item here instantly navigating the view on the right, it does that but also drills down in the menu on the left. I.e. click "About us", and not only does it load the about page on the right, it also drills down to an "About" page drilldown menu in the left sidebar. This allows us to surface things like page metadata, visibility, perhaps even page templates to choose from, right then and there. A separate thing, but wanted to mention the idea as I think it's a good one. |
I just cherry-picked this PR to the release/15.1 branch to get it included in the next release: 6f79269 |
This PR adds the ability to navigate to items in the navigation menu.
Video
Screen.Recording.2023-01-24.at.17.47.31.mov