Skip to content
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

Update the global styles sidebar to use a navigation component #34885

Merged
merged 6 commits into from
Sep 20, 2021

Conversation

youknowriad
Copy link
Contributor

This is still a bit ugly but it moves us forward a bit in #34574

Here's the idea:

  • We need to integrate a Navigation component into the global styles sidebar to reduce complexity
  • The current Navigation component is not great and the new one (G2) is not ready yet.
  • Can we update the current global styles a bit to integrate the navigation drill down without big refactorings to existing components to get the ball rolling (which would allow us to see the pieces in action and iterate on them).

Based on this:

  • I updated the existing navigation component to make its colors less specific to the left sidebar (dark background), meaning there are some light changes in the color there but I think it's decent for a temporary component.
  • Integrate the navigation menus into the current sidebar

This still needs a bit of work to get something shippable as an iteration but I wanted to share to get some eyes on this.
I think it needs:

  • Remove the Collapsible Panels from the sidebar
  • Add some contextual information indicating where we are in the menu (especially for blocks)

WDYT

@youknowriad youknowriad added the Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json label Sep 16, 2021
@youknowriad youknowriad self-assigned this Sep 16, 2021
@github-actions
Copy link

github-actions bot commented Sep 16, 2021

Size Change: +900 B (0%)

Total Size: 1.06 MB

Filename Size Change
build/block-editor/index.min.js 128 kB +22 B (0%)
build/components/index.min.js 210 kB -4 B (0%)
build/edit-post/style-rtl.css 7.18 kB -51 B (-1%)
build/edit-post/style.css 7.17 kB -51 B (-1%)
build/edit-site/index.min.js 27.2 kB +788 B (+3%)
build/edit-site/style-rtl.css 5.17 kB +98 B (+2%)
build/edit-site/style.css 5.16 kB +98 B (+2%)
ℹ️ View Unchanged
Filename Size
build/a11y/index.min.js 931 B
build/admin-manifest/index.min.js 1.09 kB
build/annotations/index.min.js 2.7 kB
build/api-fetch/index.min.js 2.19 kB
build/autop/index.min.js 2.08 kB
build/blob/index.min.js 459 B
build/block-directory/index.min.js 6.2 kB
build/block-directory/style-rtl.css 1.01 kB
build/block-directory/style.css 1.01 kB
build/block-editor/default-editor-styles-rtl.css 378 B
build/block-editor/default-editor-styles.css 378 B
build/block-editor/style-rtl.css 13.9 kB
build/block-editor/style.css 13.8 kB
build/block-library/blocks/archives/editor-rtl.css 61 B
build/block-library/blocks/archives/editor.css 60 B
build/block-library/blocks/archives/style-rtl.css 65 B
build/block-library/blocks/archives/style.css 65 B
build/block-library/blocks/audio/editor-rtl.css 58 B
build/block-library/blocks/audio/editor.css 58 B
build/block-library/blocks/audio/style-rtl.css 111 B
build/block-library/blocks/audio/style.css 111 B
build/block-library/blocks/audio/theme-rtl.css 125 B
build/block-library/blocks/audio/theme.css 125 B
build/block-library/blocks/block/editor-rtl.css 161 B
build/block-library/blocks/block/editor.css 161 B
build/block-library/blocks/button/editor-rtl.css 474 B
build/block-library/blocks/button/editor.css 474 B
build/block-library/blocks/button/style-rtl.css 600 B
build/block-library/blocks/button/style.css 600 B
build/block-library/blocks/buttons/editor-rtl.css 315 B
build/block-library/blocks/buttons/editor.css 315 B
build/block-library/blocks/buttons/style-rtl.css 370 B
build/block-library/blocks/buttons/style.css 370 B
build/block-library/blocks/calendar/style-rtl.css 207 B
build/block-library/blocks/calendar/style.css 207 B
build/block-library/blocks/categories/editor-rtl.css 84 B
build/block-library/blocks/categories/editor.css 83 B
build/block-library/blocks/categories/style-rtl.css 79 B
build/block-library/blocks/categories/style.css 79 B
build/block-library/blocks/code/style-rtl.css 90 B
build/block-library/blocks/code/style.css 90 B
build/block-library/blocks/code/theme-rtl.css 131 B
build/block-library/blocks/code/theme.css 131 B
build/block-library/blocks/columns/editor-rtl.css 206 B
build/block-library/blocks/columns/editor.css 205 B
build/block-library/blocks/columns/style-rtl.css 497 B
build/block-library/blocks/columns/style.css 496 B
build/block-library/blocks/cover/editor-rtl.css 666 B
build/block-library/blocks/cover/editor.css 670 B
build/block-library/blocks/cover/style-rtl.css 1.23 kB
build/block-library/blocks/cover/style.css 1.23 kB
build/block-library/blocks/embed/editor-rtl.css 488 B
build/block-library/blocks/embed/editor.css 488 B
build/block-library/blocks/embed/style-rtl.css 417 B
build/block-library/blocks/embed/style.css 417 B
build/block-library/blocks/embed/theme-rtl.css 124 B
build/block-library/blocks/embed/theme.css 124 B
build/block-library/blocks/file/editor-rtl.css 300 B
build/block-library/blocks/file/editor.css 300 B
build/block-library/blocks/file/style-rtl.css 255 B
build/block-library/blocks/file/style.css 255 B
build/block-library/blocks/file/view.min.js 322 B
build/block-library/blocks/freeform/editor-rtl.css 2.44 kB
build/block-library/blocks/freeform/editor.css 2.44 kB
build/block-library/blocks/gallery/editor-rtl.css 983 B
build/block-library/blocks/gallery/editor.css 988 B
build/block-library/blocks/gallery/style-rtl.css 1.6 kB
build/block-library/blocks/gallery/style.css 1.59 kB
build/block-library/blocks/gallery/theme-rtl.css 122 B
build/block-library/blocks/gallery/theme.css 122 B
build/block-library/blocks/group/editor-rtl.css 159 B
build/block-library/blocks/group/editor.css 159 B
build/block-library/blocks/group/style-rtl.css 57 B
build/block-library/blocks/group/style.css 57 B
build/block-library/blocks/group/theme-rtl.css 78 B
build/block-library/blocks/group/theme.css 78 B
build/block-library/blocks/heading/style-rtl.css 114 B
build/block-library/blocks/heading/style.css 114 B
build/block-library/blocks/home-link/style-rtl.css 247 B
build/block-library/blocks/home-link/style.css 247 B
build/block-library/blocks/html/editor-rtl.css 332 B
build/block-library/blocks/html/editor.css 333 B
build/block-library/blocks/image/editor-rtl.css 728 B
build/block-library/blocks/image/editor.css 728 B
build/block-library/blocks/image/style-rtl.css 482 B
build/block-library/blocks/image/style.css 487 B
build/block-library/blocks/image/theme-rtl.css 124 B
build/block-library/blocks/image/theme.css 124 B
build/block-library/blocks/latest-comments/style-rtl.css 284 B
build/block-library/blocks/latest-comments/style.css 284 B
build/block-library/blocks/latest-posts/editor-rtl.css 137 B
build/block-library/blocks/latest-posts/editor.css 137 B
build/block-library/blocks/latest-posts/style-rtl.css 528 B
build/block-library/blocks/latest-posts/style.css 527 B
build/block-library/blocks/list/style-rtl.css 94 B
build/block-library/blocks/list/style.css 94 B
build/block-library/blocks/media-text/editor-rtl.css 266 B
build/block-library/blocks/media-text/editor.css 263 B
build/block-library/blocks/media-text/style-rtl.css 488 B
build/block-library/blocks/media-text/style.css 485 B
build/block-library/blocks/more/editor-rtl.css 431 B
build/block-library/blocks/more/editor.css 431 B
build/block-library/blocks/navigation-link/editor-rtl.css 489 B
build/block-library/blocks/navigation-link/editor.css 488 B
build/block-library/blocks/navigation-link/style-rtl.css 94 B
build/block-library/blocks/navigation-link/style.css 94 B
build/block-library/blocks/navigation-submenu/editor-rtl.css 300 B
build/block-library/blocks/navigation-submenu/editor.css 299 B
build/block-library/blocks/navigation-submenu/style-rtl.css 195 B
build/block-library/blocks/navigation-submenu/style.css 195 B
build/block-library/blocks/navigation-submenu/view.min.js 343 B
build/block-library/blocks/navigation/editor-rtl.css 1.72 kB
build/block-library/blocks/navigation/editor.css 1.72 kB
build/block-library/blocks/navigation/style-rtl.css 1.5 kB
build/block-library/blocks/navigation/style.css 1.49 kB
build/block-library/blocks/navigation/view.min.js 2.74 kB
build/block-library/blocks/nextpage/editor-rtl.css 395 B
build/block-library/blocks/nextpage/editor.css 395 B
build/block-library/blocks/page-list/editor-rtl.css 377 B
build/block-library/blocks/page-list/editor.css 377 B
build/block-library/blocks/page-list/style-rtl.css 202 B
build/block-library/blocks/page-list/style.css 202 B
build/block-library/blocks/paragraph/editor-rtl.css 157 B
build/block-library/blocks/paragraph/editor.css 157 B
build/block-library/blocks/paragraph/style-rtl.css 273 B
build/block-library/blocks/paragraph/style.css 273 B
build/block-library/blocks/post-author/editor-rtl.css 210 B
build/block-library/blocks/post-author/editor.css 210 B
build/block-library/blocks/post-author/style-rtl.css 182 B
build/block-library/blocks/post-author/style.css 181 B
build/block-library/blocks/post-comments-form/style-rtl.css 140 B
build/block-library/blocks/post-comments-form/style.css 140 B
build/block-library/blocks/post-comments/style-rtl.css 360 B
build/block-library/blocks/post-comments/style.css 359 B
build/block-library/blocks/post-content/editor-rtl.css 138 B
build/block-library/blocks/post-content/editor.css 138 B
build/block-library/blocks/post-excerpt/editor-rtl.css 73 B
build/block-library/blocks/post-excerpt/editor.css 73 B
build/block-library/blocks/post-excerpt/style-rtl.css 69 B
build/block-library/blocks/post-excerpt/style.css 69 B
build/block-library/blocks/post-featured-image/editor-rtl.css 398 B
build/block-library/blocks/post-featured-image/editor.css 398 B
build/block-library/blocks/post-featured-image/style-rtl.css 143 B
build/block-library/blocks/post-featured-image/style.css 143 B
build/block-library/blocks/post-template/editor-rtl.css 99 B
build/block-library/blocks/post-template/editor.css 98 B
build/block-library/blocks/post-template/style-rtl.css 378 B
build/block-library/blocks/post-template/style.css 379 B
build/block-library/blocks/post-terms/style-rtl.css 73 B
build/block-library/blocks/post-terms/style.css 73 B
build/block-library/blocks/post-title/style-rtl.css 60 B
build/block-library/blocks/post-title/style.css 60 B
build/block-library/blocks/preformatted/style-rtl.css 103 B
build/block-library/blocks/preformatted/style.css 103 B
build/block-library/blocks/pullquote/editor-rtl.css 198 B
build/block-library/blocks/pullquote/editor.css 198 B
build/block-library/blocks/pullquote/style-rtl.css 378 B
build/block-library/blocks/pullquote/style.css 378 B
build/block-library/blocks/pullquote/theme-rtl.css 167 B
build/block-library/blocks/pullquote/theme.css 167 B
build/block-library/blocks/query-pagination-numbers/editor-rtl.css 122 B
build/block-library/blocks/query-pagination-numbers/editor.css 121 B
build/block-library/blocks/query-pagination/editor-rtl.css 262 B
build/block-library/blocks/query-pagination/editor.css 255 B
build/block-library/blocks/query-pagination/style-rtl.css 234 B
build/block-library/blocks/query-pagination/style.css 231 B
build/block-library/blocks/query-title/editor-rtl.css 85 B
build/block-library/blocks/query-title/editor.css 85 B
build/block-library/blocks/query/editor-rtl.css 131 B
build/block-library/blocks/query/editor.css 132 B
build/block-library/blocks/quote/style-rtl.css 187 B
build/block-library/blocks/quote/style.css 187 B
build/block-library/blocks/quote/theme-rtl.css 220 B
build/block-library/blocks/quote/theme.css 222 B
build/block-library/blocks/rss/editor-rtl.css 202 B
build/block-library/blocks/rss/editor.css 204 B
build/block-library/blocks/rss/style-rtl.css 289 B
build/block-library/blocks/rss/style.css 288 B
build/block-library/blocks/search/editor-rtl.css 165 B
build/block-library/blocks/search/editor.css 165 B
build/block-library/blocks/search/style-rtl.css 374 B
build/block-library/blocks/search/style.css 375 B
build/block-library/blocks/search/theme-rtl.css 64 B
build/block-library/blocks/search/theme.css 64 B
build/block-library/blocks/separator/editor-rtl.css 99 B
build/block-library/blocks/separator/editor.css 99 B
build/block-library/blocks/separator/style-rtl.css 250 B
build/block-library/blocks/separator/style.css 250 B
build/block-library/blocks/separator/theme-rtl.css 172 B
build/block-library/blocks/separator/theme.css 172 B
build/block-library/blocks/shortcode/editor-rtl.css 474 B
build/block-library/blocks/shortcode/editor.css 474 B
build/block-library/blocks/site-logo/editor-rtl.css 462 B
build/block-library/blocks/site-logo/editor.css 464 B
build/block-library/blocks/site-logo/style-rtl.css 153 B
build/block-library/blocks/site-logo/style.css 153 B
build/block-library/blocks/site-tagline/editor-rtl.css 86 B
build/block-library/blocks/site-tagline/editor.css 86 B
build/block-library/blocks/site-title/editor-rtl.css 84 B
build/block-library/blocks/site-title/editor.css 84 B
build/block-library/blocks/social-link/editor-rtl.css 165 B
build/block-library/blocks/social-link/editor.css 165 B
build/block-library/blocks/social-links/editor-rtl.css 812 B
build/block-library/blocks/social-links/editor.css 811 B
build/block-library/blocks/social-links/style-rtl.css 1.3 kB
build/block-library/blocks/social-links/style.css 1.3 kB
build/block-library/blocks/spacer/editor-rtl.css 307 B
build/block-library/blocks/spacer/editor.css 307 B
build/block-library/blocks/spacer/style-rtl.css 48 B
build/block-library/blocks/spacer/style.css 48 B
build/block-library/blocks/table/editor-rtl.css 471 B
build/block-library/blocks/table/editor.css 472 B
build/block-library/blocks/table/style-rtl.css 481 B
build/block-library/blocks/table/style.css 481 B
build/block-library/blocks/table/theme-rtl.css 188 B
build/block-library/blocks/table/theme.css 188 B
build/block-library/blocks/tag-cloud/style-rtl.css 146 B
build/block-library/blocks/tag-cloud/style.css 146 B
build/block-library/blocks/template-part/editor-rtl.css 636 B
build/block-library/blocks/template-part/editor.css 635 B
build/block-library/blocks/template-part/theme-rtl.css 101 B
build/block-library/blocks/template-part/theme.css 101 B
build/block-library/blocks/term-description/editor-rtl.css 90 B
build/block-library/blocks/term-description/editor.css 90 B
build/block-library/blocks/text-columns/editor-rtl.css 95 B
build/block-library/blocks/text-columns/editor.css 95 B
build/block-library/blocks/text-columns/style-rtl.css 166 B
build/block-library/blocks/text-columns/style.css 166 B
build/block-library/blocks/verse/style-rtl.css 87 B
build/block-library/blocks/verse/style.css 87 B
build/block-library/blocks/video/editor-rtl.css 571 B
build/block-library/blocks/video/editor.css 572 B
build/block-library/blocks/video/style-rtl.css 173 B
build/block-library/blocks/video/style.css 173 B
build/block-library/blocks/video/theme-rtl.css 124 B
build/block-library/blocks/video/theme.css 124 B
build/block-library/common-rtl.css 853 B
build/block-library/common.css 849 B
build/block-library/editor-rtl.css 9.71 kB
build/block-library/editor.css 9.7 kB
build/block-library/index.min.js 153 kB
build/block-library/reset-rtl.css 527 B
build/block-library/reset.css 527 B
build/block-library/style-rtl.css 10.3 kB
build/block-library/style.css 10.3 kB
build/block-library/theme-rtl.css 665 B
build/block-library/theme.css 669 B
build/block-serialization-default-parser/index.min.js 1.09 kB
build/block-serialization-spec-parser/index.min.js 2.79 kB
build/blocks/index.min.js 46.9 kB
build/components/style-rtl.css 15.8 kB
build/components/style.css 15.8 kB
build/compose/index.min.js 10.3 kB
build/core-data/index.min.js 12.3 kB
build/customize-widgets/index.min.js 11.1 kB
build/customize-widgets/style-rtl.css 1.5 kB
build/customize-widgets/style.css 1.49 kB
build/data-controls/index.min.js 614 B
build/data/index.min.js 7.1 kB
build/date/index.min.js 31.5 kB
build/deprecated/index.min.js 428 B
build/dom-ready/index.min.js 304 B
build/dom/index.min.js 4.45 kB
build/edit-navigation/index.min.js 16.3 kB
build/edit-navigation/style-rtl.css 3.7 kB
build/edit-navigation/style.css 3.7 kB
build/edit-post/classic-rtl.css 492 B
build/edit-post/classic.css 494 B
build/edit-post/index.min.js 28.9 kB
build/edit-widgets/index.min.js 16.1 kB
build/edit-widgets/style-rtl.css 4.09 kB
build/edit-widgets/style.css 4.09 kB
build/editor/index.min.js 37.7 kB
build/editor/style-rtl.css 3.76 kB
build/editor/style.css 3.75 kB
build/element/index.min.js 3.17 kB
build/escape-html/index.min.js 517 B
build/format-library/index.min.js 5.34 kB
build/format-library/style-rtl.css 668 B
build/format-library/style.css 670 B
build/hooks/index.min.js 1.55 kB
build/html-entities/index.min.js 424 B
build/i18n/index.min.js 3.6 kB
build/is-shallow-equal/index.min.js 501 B
build/keyboard-shortcuts/index.min.js 1.72 kB
build/keycodes/index.min.js 1.3 kB
build/list-reusable-blocks/index.min.js 1.85 kB
build/list-reusable-blocks/style-rtl.css 838 B
build/list-reusable-blocks/style.css 838 B
build/media-utils/index.min.js 2.88 kB
build/notices/index.min.js 845 B
build/nux/index.min.js 2.03 kB
build/nux/style-rtl.css 747 B
build/nux/style.css 743 B
build/plugins/index.min.js 1.83 kB
build/primitives/index.min.js 921 B
build/priority-queue/index.min.js 582 B
build/react-i18n/index.min.js 671 B
build/redux-routine/index.min.js 2.63 kB
build/reusable-blocks/index.min.js 2.28 kB
build/reusable-blocks/style-rtl.css 256 B
build/reusable-blocks/style.css 256 B
build/rich-text/index.min.js 10.6 kB
build/server-side-render/index.min.js 1.32 kB
build/shortcode/index.min.js 1.48 kB
build/token-list/index.min.js 562 B
build/url/index.min.js 1.74 kB
build/viewport/index.min.js 1.02 kB
build/warning/index.min.js 248 B
build/widgets/index.min.js 7.27 kB
build/widgets/style-rtl.css 1.17 kB
build/widgets/style.css 1.18 kB
build/wordcount/index.min.js 1.04 kB

compressed-size-action

@ciampo
Copy link
Contributor

ciampo commented Sep 16, 2021

Thank you for pushing the work on the Global Styles Sidebar forward!

  • We need to integrate a Navigation component into the global styles sidebar to reduce complexity
  • The current Navigation component is not great and the new one (G2) is not ready yet.
  • Can we update the current global styles a bit to integrate the navigation drill down without big refactorings to existing components to get the ball rolling (which would allow us to see the pieces in action and iterate on them).

Based on this:

  • Integrate the navigation menus into the current sidebar

My preference would be to try using the Navigation (and routing) components from the G2 prototype, similarly to the approach taken in #32923 (comment).

I'm afraid that using the current set of Gutenberg Navigation components will make it harder for us to make changes to it in the future.

This PR (and, more in general, the initial phase of this project) feels like a perfect time to test those experimental Navigation components in a real-world scenario — which ultimately will help us to understand better their advantages and their limitations and to make a better-informed decision later on.

@youknowriad
Copy link
Contributor Author

I'm not at ease with having two experimental navigation components in the codebase tbh. That said, switching from one to another doesn't sound complex to me as they are supposed to have the same feature set and we're free to brake the API. I'll try a bit tomorrow to see how far I can go.

@jasmussen
Copy link
Contributor

I'll dive into this a bit tomorrow, but just as a quick glance at the changeset, the CSS and CSS-in-JS changes/cleanup alone look like a big improvement.

Copy link
Member

@jorgefilipecosta jorgefilipecosta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the direction of this PR it simplifies multiple things, for example, there is no need for an explicit router in it.
I think it would be good to check if we can replicate this design using the navigation components or if we need to extend them etc.
image

/>
</NavigationMenu>
<NavigationMenu menu="blocks" parentMenu="root">
{ map( blocks, ( _, name ) => (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously we were sorting blocks alphabetically. Should we still do it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should they follow the inserter's order?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, inserter order, and possibly with categories down the road.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need a search box too for quick finding.

@ciampo
Copy link
Contributor

ciampo commented Sep 16, 2021

I'm not at ease with having two experimental navigation components in the codebase tbh.

The idea is for the newly introduced set of Navigation/Routing components to be private/local to the Global Styles sidebar, without being exposed to other parts of the repo.

That said, switching from one to another doesn't sound complex to me as they are supposed to have the same feature set and we're free to break the API.

I think that the two sets of components, despite they try to achieve similar results, have a quite different approach:

  • The Gutenberg set feels quite tailored to menus — to the point that the "panels" representing the current "view" are wrapped in a NavigationMenu component — and overall feels much more imperative
  • The "G2" set feels more generic and abstract and has a more declarative approach (I believe its routing components are a slightly modified version of the react-router ones)

Of course, this doesn't mean that refactoring from one approach to another one is going to be impossible. But the previous comment from @jorgefilipecosta is a great example of the point I'm trying to make:

I think it would be good to check if we can replicate this design using the navigation components or if we need to extend them etc.

The G2 Global Styles prototype (which includes the g2 Navigation/Routing components) already achieves most of the requirements from the latest designs.

If we pick the existing set of Gutenberg Navigation components and start iterating on them, we won't have a way of trying the G2 set of components out. By working iteratively on the Gutenberg set of components, we will slowly consolidate them and make it harder to introduce an alternative approach as time passes.

Also, I don't think that a set of Navigation/Routing components should try to achieve a certain design — they should instead focus on the navigation logic, and be easily extensible by the part of the App which consumes them (this part would be in charge of styling the components)

I'll try a bit tomorrow to see how far I can go.

Thank you! Let's take it from there.

@jasmussen
Copy link
Contributor

Coming at this from the purely visual angle, from what I can tell, the changes so far are primarily related to the resting color of the link items. Trunk:
Screenshot 2021-09-17 at 08 03 03

This branch:

Screenshot 2021-09-17 at 08 05 01

Links in both of the above have plenty of contrast (5+:1), but since @jameskoster worked on the design, I'd love a quick sanity check on this change.

@@ -47,16 +45,19 @@ export const MenuUI = styled.div`

export const MenuBackButtonUI = styled( Button )`
&.is-tertiary {
color: ${ G2.lightGray.ui };
color: inherit;
opacity: 0.85;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears the trick here is to use opacities to define the grays, so that colors can be inherited from context instead of explicitly set to light or dark. I suspect that can work as a holdover, but it inherently becomes a bit more fuzzy, so I'd love for us to be able to feed it some specific colors.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's the solution. I don't think we need to be more clever than that for the moment. Adding explicit colors (and modes dark/light) is going to be harder and that component is supposed to go away anyway.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we can go back and tune the colors once we're happy with the overall component, it seems fine to go with the opacity solution in the mean time 👍 👍

@youknowriad
Copy link
Contributor Author

The idea is for the newly introduced set of Navigation/Routing components to be private/local to the Global Styles sidebar, without being exposed to other parts of the repo.

I don't think leaving it private is any different than another experimental component, another experimental component is actually better since it allows us to start migrating the usage of the current one eventually removing it.

@youknowriad
Copy link
Contributor Author

The "G2" set feels more generic and abstract and has a more declarative approach (I believe its routing components are a slightly modified version of the react-router ones)

To be clear here, I like this approach better (generic declarative approach) and leave the UI bits to the existing UI components. I'm just trying to be tactical and see what's best to move forward.

@youknowriad
Copy link
Contributor Author

@ciampo I've given the Navigator a try and there are a few things that we should do before trying to use it IMO. The important one is that It's tied to the browser history/url right now and for me this is a big blocker as you won't be able to use multiple ones on the same page.

That said, I think migration from one to another won't be complex (approximatively):

1- transform "menuIds" to "paths"
2- Instead of relying on a built in NavigationItem component, build a custom component just use Button.... and have something like a useRouter hook to make transitions (the currently provided NavigatorLink are not flexible enough, they work on history and location)
3- Rename NavigationMenus in general to NavigationScreen

@youknowriad youknowriad added the Needs Design Feedback Needs general design feedback. label Sep 17, 2021
@youknowriad
Copy link
Contributor Author

Can I have another look on the design at the moment. I think it's becoming decent enough to consider it an improvement over trunk.

Here are my current thoughts: I agree with @ciampo that the current Navigation component are not great and too specific to the "menus" use-case. They don't allow some design specifics (or not easily without hacking CSS). We should definitely consider moving to the new one but the new one doesn't seem ready yet for me and would require work (especially on the router site to break the dependency towards browser history and url)

That said, the current global styles sidebar on trunk is not in an acceptable state for WordPress 5.9 and we need to get the ball rolling feature wise. Moving to a navigation system will allow us to iterate on the other smaller parts (color picker, typography and layout panels) in context which is always easier while also working on bringing the new Navigation components in, in parallel.

@jasmussen
Copy link
Contributor

Overall, it looks like there are giant steps forward on the path to #34574:
here

As noted, the hack that allows color inheritance through opacity isn't the greatest: item colors in the W menu are too bright, and items in the global styles menu are too light gray. But as a tradeoff in moving global styles forward, it feels worth it, provided we come back to revisit this and correct the button colors. Should we ticket it?

Separately, the double border at the top of the GS sidebar would be very nice to remove soon, this one:
Screenshot 2021-09-17 at 12 00 31

And the subheadings in the W menu are missing correct spacing, font size and font weight:

Screenshot 2021-09-17 at 12 00 40

Those are existing issues, but as the other pieces start moving in the right direction, they are becoming increasingly visible.

@youknowriad
Copy link
Contributor Author

Looks like I've found a way to use the new Navigator component without necessary using the URL. I'll see if I can open a separate PR to explore that which would give us more design flexibility.

@ntsekouras
Copy link
Contributor

IMO design-wise this is a great improvement from what we currently have! I agree that we will need to use the new component, but until then this feels like the next step for now.

@ciampo
Copy link
Contributor

ciampo commented Sep 17, 2021

Thank you @youknowriad for looking a bit more into the new Navigation components.

the current global styles sidebar on trunk is not in an acceptable state for WordPress 5.9 and we need to get the ball rolling feature wise. Moving to a navigation system will allow us to iterate on the other smaller parts (color picker, typography and layout panels) in context which is always easier while also working on bringing the new Navigation components in, in parallel.

I understand the need to move this forward. It would be great if we could continue developing other areas of the stylebar (colors, typography and layout panels and UIs) while keeping in mind that the current navigation is a temporary (placeholder) solution.

And as you suggested, it would be great if we kept exploring the new Navigation components in parallel, since I believe that they can provide a better (and more versatile) navigation/routing system than the current one.

Looks like I've found a way to use the new Navigator component without necessary using the URL. I'll see if I can open a separate PR to explore that which would give us more design flexibility.

This would be great. We definitely need to explore this aspect more, since ideally we'd want a navigation/routing system that can have multiple "roots" within the same page (e.g. the sidebar, the Wordpress menu, but we should also keep in mind that the Block Editor as a whole can be embedded in another app with its own routing system). Coordinating with browser history (and the URL) is definitely part of this.

@youknowriad
Copy link
Contributor Author

There are still some things to improve in the new Navigation components but #34904 builds on top of the current PR to move to these new components and offer more styling flexibility.

Let's try to get the current PR in in a decent state and then we can try to land the refactor on top of it.

@mtias
Copy link
Member

mtias commented Sep 20, 2021

@youknowriad not sure how you want to structure the breadcrumb navigation, but in the designs the current page is the one written on it. (We might need a tooltip that says "Back to Blocks".)

When you are in Palette:

image

@mtias
Copy link
Member

mtias commented Sep 20, 2021

This looks good to me as a start!

@mtias
Copy link
Member

mtias commented Sep 20, 2021

Just noting for reference, I see an error when loading and going to "colors" as the first item that crashes. Also when modifying typography items: Error: The entity being edited (postType, wp_global_styles) does not have a loaded config.

@youknowriad
Copy link
Contributor Author

Can I get an approval here?

@jameskoster
Copy link
Contributor

Links in both of the above have plenty of contrast (5+:1), but since @jameskoster worked on the design, I'd love a quick sanity check on this change.

Iirc we made the links a bit darker to better contrast them against the headings which are otherwise very similar in appearance. Particularly when a description isn't present on the links:

Screenshot 2021-09-20 at 11 48 15

If adjusting the colors is a pain, maybe we can do something with the type treatment of the headings instead? (It looks like there has been a regression there anyway, I'm sure they used to be larger and heavier 🤔)


My only other comment is that the gray-on-blue for the active link looks a bit muddy versus the white-on-blue on trunk.

@youknowriad
Copy link
Contributor Author

@jameskoster we can always add temporary CSS to override the navigation defaults for the site editor sidebar. What could this look like?

@youknowriad youknowriad force-pushed the try/background-independent-navigation-component branch from a66299e to 6dc5e41 Compare September 20, 2021 10:57
@jameskoster
Copy link
Contributor

jameskoster commented Sep 20, 2021

@youknowriad if we fix the headings (I can do that separately – doesn't need to hold this PR up) then the only thing we should address here imo is the color of the text on the active state.

Screenshot 2021-09-20 at 12 17 12

This text should be white instead of gray.


Opened an issue here for the headings.

@youknowriad
Copy link
Contributor Author

Ok, I've made some updates, I think the balance is better now.

@youknowriad youknowriad merged commit 0d6d63d into trunk Sep 20, 2021
@youknowriad youknowriad deleted the try/background-independent-navigation-component branch September 20, 2021 13:33
@github-actions github-actions bot added this to the Gutenberg 11.6 milestone Sep 20, 2021
@youknowriad youknowriad mentioned this pull request Sep 21, 2021
16 tasks

if ( typeof blocks !== 'object' || ! root ) {
// No sidebar is shown.
Copy link
Member

@oandregal oandregal Oct 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@youknowriad 👋 This was for preventing the GS sidebar from loading if the theme didn't have a theme.json (including themes that have a experimental-theme.json file, which we don't backfill to theme.json). We now load the global sidebar for all themes, resulting in a weird situation: all panels are empty, clicking the color panel will prompts an error, clicking "reset to defaults" (for a theme with experimental-theme.json that was used in the past to store data) will also prompts an error, etc.

What can we do now to hide this sidebar if the theme does not have a theme.json?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have trouble understanding in which case this happen? This is for FSE themes only which are supposed to have theme.json. If they don't have theme.json, I expect FSE themes to just use the default one?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can share the rationale we had at the time: if a theme doesn't have a theme.json, the sidebar is hidden, no matter whether they have block templates or not. The reason for this is that if the theme does not have a theme.json we don't know whether the user styles are going to play well with it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see the logic especially for classic themes but maybe not for FSE themes and right now the site editor (the sidebar) is only for FSE themes where everything is blocks. WDYT

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For context, I was running into an issue where the wp_global_styles CPT was not registered and the editor was breaking. I think we should guard against the presence of the CPT better, because there could be different reasons why it's not there.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, the CPT is only registered when the theme has a theme.json. If we change how the sidebar behaves, we should also update that logic. Something we can do is to compute the logic only in the server and pass the client a flag, instead of computing it in the client as well: that way we only need to change one place.

As for when this should be available, I'd be inclined to only load the sidebar when the theme has a theme.json. Though, I don't see any blocker to make it work like Riad mentioned (theme.json or block templates): it can be done, we just need to update the server logic to make the user CPT available also in that case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the CPT is only registered when the theme has a theme.json.

I didn't know about that, it makes sense to unify the check and I'd vote for (theme.json or FSE theme) personally.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR to centralize the logic and clarify how this should work at #35427

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json Needs Design Feedback Needs general design feedback.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants