-
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
Display a document icon when using the site editor #48052
Conversation
I think something like this can help, but we might need a more nuanced solution, or at least some more design exploration to ensure this is the correct direction. The truth is that while working on a single document in the site editor you can potentially end up editing several additional elements all at the same time. For example if you open the
We also need to think about how users interpret the 'document' in certain flows. For example if you navigate to Site Editor > Navigation > About > Edit – I think most people would feel like they're editing their About page primarily, rather than the All that considered, framing the session around a single document may be too blunt of an instrument. I wonder if there's a way we can make the title more dynamic so that it communicates the context for the selected block. We've explored this a little for template parts, can we take it further? |
@jameskoster, sorry can I just get some more clarity on the next steps here? I'm not sure that this PR changes the level of single document framing. This PR prefixes the top-level document name with an appropriate icon. When editing a template-part while editing a template, the document name is currently already suffixed with the template-part icon and the name of the template part being edited. This is unchanged. Are you saying you want to see this template-part behaviour (or something similar) for entities other than template parts as part of this PR? What is a design exploration and how can I get one? |
Apologies I may have gone into the weeds a bit there. Would you mind rebasing and increasing the gap a bit between icon + title? Then we can get more reviews. |
Cheers @jameskoster I've rebased and added spacing between a title and it's icon, and increased spacing between primary and secondary titles too to suit. Getting the correct amounts of spacing between things is something I don't have much confidence in, so I'd love to hear some feedback. I've updated the after screenshots on the description so you can easily see what I've done. |
Thanks for updating :) Rather than using CSS you might be interested in the HStack component. If you stick with css, let's use the I think we can get broader feedback from @WordPress/gutenberg-design now. |
Thanks for the help @jameskoster, I've used $grid-unit variables for values now. No objection to moving to HStack in general, but perhaps that should happen to the DocumentActions component regardless of whether this PR lands? |
This feels like a fine enough solution to me. Btw should either or both of those use the Home icon? Not a blocker for this PR, in fact probably a rabbit hole. But mentioning it nevertheless. Header template part: Before we move too much further, I'd love a quick take by @SaxonF, as I know he's explored a different format for this top/center chip. |
It's a good question. To connect the dot, we currently use icons in the Add template menu: It might be confusing to see different icons in these two locations, especially immediately after creating the template. The icons in the add template menu are not canonical, and imo do not add much value. The most important distinction to make going forwards is whether you're editing content or a template, and in that respect fewer icons is probably better. So with that said, I think the behavior in this PR is good, and as a follow-up we can remove the decorative icons in the add template menu. |
I'm not sure it makes sense to hide it when a part is selected, other than just too much noise. But I'm still finding it difficult to justify it hiding. And this brings me back to the caret breadcrumb mock-ups in the header. Missing the context it provides as a breadcrumb. |
I noticed this is also included in #49980, which validates the idea, but since that PR includes additional functionality around this element perhaps it makes sense to concentrate on that one? |
The functionality in #49980 looks specific to when editing a page. The functionality in this diff would still continue to work and be useful. This part of the 49980 diff determines which header to use - the existing Stylebook header, the new to 49980 PageContentBreadcrumbs header or DocumentActions - the header I've modified in this diff. We should align on using the same icon though - #49980 uses the sidebar icon rather than getting the icon from the template being edited. |
Thanks for digging into that. Agree on making the icon usage consistent – I'd lean towards using |
Returning the entity icon from useEditedEntityRecord so that it can be displayed in related places in the UI.
Prefixing the template / template-part name with the icon of the entity being edited provides an additional hint to the user as to what they're editing.
* Increase spacing between document/secondary titles and their icons by 4px * Increase spacing between document and secondary titles by 6px
@jameskoster this PR already does use Or rather, it gets the icon from the entities being edited, thus ensuring it remains consistent with everything else. I've commented on #49980 about being consistent. Can you help me out with next steps? |
@jameskoster that looks exciting! I'll close this issue then. Thanks for your help, and thank you to everyone else for commenting too. |
What?
Displaying an icon next to the title when using the site editor.
Why?
Many users are confused when entering the Site Editor - not understanding the context that they are editing elements under (within templates). This often results in content which is intended for a single page being added as content to the template (amongst other things). The Site Editor header displays the current document's name, but not its type. This change gives an additional hint to users what is being edited.
How?
The
useEditedEntityRecord
hook now returns an icon for the entity being edited.The
DocumentActions
component displays this icon in the document action titleTesting Instructions
Testing Instructions for Keyboard
Keyboard navigation is unaffected.
Screenshots or screencast