-
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
Navigation Focus Mode: Ability to access/edit Navigation Post items in isolation #37950
Comments
cc @mtias This is an important next step alongside other nav block refinements. I think this needs some design input, so will add a label. From a UI perspective, the main thing is that the inner content of the nav block is distinct from the navigation block styles (a bit like the situation here for template parts - #30641), so there would be no way to customize colors, overlay menus and some of the other visual styles in a standalone editor. Or even show those styles. Should this be more of a pure link editing mode? In a focus mode it could be possible as @kevin940726 mentions here - #30641 (comment). From a technical perspective, some of the challenges are detailed here - #36589 (comment).
I don't know how valuable this would be. Links are mostly dynamic blocks, so it's not like users will be able to adjust the HTML. I'd be a bit concerned about it being too easy to make a mistake. It could be a power user feature like the Code Editor, but I think the primary editing option should be visual. |
In order to not introduce any new interfaces if at all possible, it seems like this could use the same interface that exists for editing the contents of template parts in isolation: The challenge is that any navigation block changes made locally are not saved along with the menu itself. So if I change the font, colors, and overlay options when editing in a template context, as soon as I click to edit in isolation, those changes will no longer be visible. At that point I'm observing the global version of items, stripped of local decoration: I chatted with @jameskoster about this, as he's been through adjacent challenges with template parts. The solution applied there was to disable local editing of colors, spacing, and layout entirely, relegating those changes to only be possible inside the isolated editor. Such a solution might not be intuitive for navigation, as there's value in visually editing in context of its surroundings. At the same time, without any handling of local and global changes (such as forcing all local changes be saved/synced with the block), we could end up with a confusing mix: for example when editing the navigation in isolation and setting it to collapse to an overlay, and then seeing it uncollapsed when exiting isolation mode, overridden by a local change. An interim solution could be to disable inspector controls for the navigation in the global/isolated interface, enabling appearance controls only in the local context. But this should probably be considered a temporary solution as it would depart from (invert) the logic applied to template parts. In that spirit, it's good to look at where template parts might go in the future, and aim towards that. This might include an interface that embraces local overrides, and even as @mtias suggests, allows template parts to become style providers. There's a lot of good discussion on that thread, pertinent to the challenge here. |
I think that might be a critical thing. We need to retain the separation of concerns between menu data and presentation. I have been considering the Navigation Editor again recently. I wonder whether we could make a nice distinction here that avoids some of the pitfalls:
In our context, the Nav block is the style provider. |
I think we need to be careful about introducing inconsistencies along the lines of some menus only being editable using one editor and other menus only be editable using another. At least without it being clear to the user why that might be. So far there hasn't been a strong proposal for making only certain menus persisted and that probably needs to be in place before it's a consideration. Is there an issue for it? It's probably time to start thinking about a new navigation block tracking issue to document the future direction of the block. Is there more information about style providers for blocks? It sounds like the idea is to store style data external to the block, much like inner blocks are stored in |
✅ #38275
I feel like there was a PR that @youknowriad was working on. Perhaps this one #37978? |
Going through notifications and finally coming to this, pardon my tardiness. @talldan this is very much what this issue was trying to capture #36667 as a next step. Now that navigation blocks are wrappers on the data values, we can present the data values in its tree form more prominently. (The mockups are showing a single main menu but it could offer more through a dropdown if the UI does indeed work. For the focused view of navigation we don't necessarily need to introduce the styles from the parent template and we can just have some default ones or none at all and default to tree views. |
No problem. I can imagine you have quite a few to get through 😄
This is what I'd like to pursue here. Start with a focused mode that is editing the "items" (the data). That can serve as a basis for other things in the future. |
Yeah, I think that would be good. The first draft doesn't need to have any special styling, it can just be a proof of concept. |
With the proliferation of these focuses modes, I think we need to start to think about how these focus modes (which are in reality) multiple editors work together. We need to answer questions like:
I'm raising this to avoid introducing all these new modes in an adhoc way and bring some clarity there. |
Isolated Editor modesSome initial research. Template Part modeScreen.Capture.on.2022-03-08.at.07-03-22.movNote this is for editing Template Parts and thus is distinct from the Template mode (see below). Appears to be a function of prop setting within gutenberg/packages/edit-site/src/components/block-editor/index.js Lines 63 to 66 in 5f140a6
Template Editing modeScreen.Capture.on.2022-03-08.at.08-57-23.movVisually this appears near identical to the Template Part editing mode, but is infact a completely different set of components in a different pacakge within: gutenberg/packages/edit-post/src/components/visual-editor/index.js Lines 244 to 253 in 6c6582f
Reusable blocks modeScreen.Capture.on.2022-03-08.at.07-05-27.movThis is far less obvious UI wise. The reusable block appears almost seamlessly within the canvas. This is a function of the
gutenberg/packages/block-library/src/block/edit.js Lines 62 to 66 in 5f140a6
|
I experimented with a focus mode editor for Navigation Menus. |
Feedback came in to support/ask for this exact experience in the nineteenth call for testing:
Passing along for context :) |
Noting feedback from @paaljoachim in this comment. |
What problem does this address?
Since the move to saving Navigation items to a custom post type (
wp_navigation
) there is no longer a way to access the inner blocks data of a Navigation block.This causes problems for users who wish to manually copy the inner blocks and use in a pattern or on another site.
Moreover, users are forced to use the Navigation block directly as the only way edit a give Navigation Post.
What is your proposed solution?
In the short term we should enable the content field on the Navigation Post type edit screen. As the inner Navigation blocks cannot currently function without a parent Navigation block, this should be forced to default to a code view. This will ensure there are no errors but will still allow power users to access the block grammar HTML.
In the longer term we should investigate
using Isolated Templaterevising the Navigation Editor to edit Navigation Posts.core/navigation-link
) to function without having to be a child of a Navigation blockThe text was updated successfully, but these errors were encountered: