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

Site Editor: Add navigation panel with placeholder content #25506

Merged
merged 18 commits into from
Sep 24, 2020

Conversation

david-szabo97
Copy link
Member

@david-szabo97 david-szabo97 commented Sep 21, 2020

Related: #25260 #25261

Description

Putting Navigation component in action! Great way to see how it cooperates with the site editor. Also acts an example of how we could implement the preview popup.

This is a minimal implementation to see the Navigation component in the Site Editor.

Needs fix

How has this been tested?

  • yarn wp-env start
  • Enable FSE
  • Open Site Editor
  • Click site logo to toggle the navigation sidebar

Screenshots

Closed:
image

Open:
image

Preview:
image

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR.

@github-actions
Copy link

github-actions bot commented Sep 21, 2020

Size Change: +873 B (0%)

Total Size: 1.17 MB

Filename Size Change
build/edit-site/index.js 20.2 kB +463 B (2%)
build/edit-site/style-rtl.css 3.51 kB +206 B (5%) 🔍
build/edit-site/style.css 3.51 kB +204 B (5%) 🔍
ℹ️ View Unchanged
Filename Size Change
build/a11y/index.js 1.14 kB 0 B
build/annotations/index.js 3.52 kB 0 B
build/api-fetch/index.js 3.34 kB 0 B
build/autop/index.js 2.72 kB 0 B
build/blob/index.js 620 B 0 B
build/block-directory/index.js 8.53 kB 0 B
build/block-directory/style-rtl.css 943 B 0 B
build/block-directory/style.css 942 B 0 B
build/block-editor/index.js 128 kB 0 B
build/block-editor/style-rtl.css 11.1 kB 0 B
build/block-editor/style.css 11.1 kB 0 B
build/block-library/editor-rtl.css 8.56 kB 0 B
build/block-library/editor.css 8.56 kB 0 B
build/block-library/index.js 135 kB 0 B
build/block-library/style-rtl.css 7.6 kB 0 B
build/block-library/style.css 7.59 kB 0 B
build/block-library/theme-rtl.css 741 B 0 B
build/block-library/theme.css 741 B 0 B
build/block-serialization-default-parser/index.js 1.78 kB 0 B
build/block-serialization-spec-parser/index.js 3.1 kB 0 B
build/blocks/index.js 47.5 kB 0 B
build/components/index.js 167 kB 0 B
build/components/style-rtl.css 15.5 kB 0 B
build/components/style.css 15.5 kB 0 B
build/compose/index.js 9.42 kB 0 B
build/core-data/index.js 12 kB 0 B
build/data-controls/index.js 1.27 kB 0 B
build/data/index.js 8.43 kB 0 B
build/date/index.js 31.9 kB 0 B
build/deprecated/index.js 772 B 0 B
build/dom-ready/index.js 568 B 0 B
build/dom/index.js 4.42 kB 0 B
build/edit-navigation/index.js 10.4 kB 0 B
build/edit-navigation/style-rtl.css 868 B 0 B
build/edit-navigation/style.css 871 B 0 B
build/edit-post/index.js 306 kB 0 B
build/edit-post/style-rtl.css 6.24 kB 0 B
build/edit-post/style.css 6.23 kB 0 B
build/edit-widgets/index.js 17.5 kB 0 B
build/edit-widgets/style-rtl.css 2.8 kB 0 B
build/edit-widgets/style.css 2.8 kB 0 B
build/editor/editor-styles-rtl.css 492 B 0 B
build/editor/editor-styles.css 493 B 0 B
build/editor/index.js 45.5 kB 0 B
build/editor/style-rtl.css 3.8 kB 0 B
build/editor/style.css 3.8 kB 0 B
build/element/index.js 4.45 kB 0 B
build/escape-html/index.js 733 B 0 B
build/format-library/index.js 7.49 kB 0 B
build/format-library/style-rtl.css 547 B 0 B
build/format-library/style.css 548 B 0 B
build/hooks/index.js 1.74 kB 0 B
build/html-entities/index.js 621 B 0 B
build/i18n/index.js 3.55 kB 0 B
build/is-shallow-equal/index.js 709 B 0 B
build/keyboard-shortcuts/index.js 2.39 kB 0 B
build/keycodes/index.js 1.85 kB 0 B
build/list-reusable-blocks/index.js 3.02 kB 0 B
build/list-reusable-blocks/style-rtl.css 476 B 0 B
build/list-reusable-blocks/style.css 476 B 0 B
build/media-utils/index.js 5.12 kB 0 B
build/notices/index.js 1.69 kB 0 B
build/nux/index.js 3.27 kB 0 B
build/nux/style-rtl.css 671 B 0 B
build/nux/style.css 668 B 0 B
build/plugins/index.js 2.44 kB 0 B
build/primitives/index.js 1.34 kB 0 B
build/priority-queue/index.js 789 B 0 B
build/redux-routine/index.js 2.85 kB 0 B
build/rich-text/index.js 13.7 kB 0 B
build/server-side-render/index.js 2.61 kB 0 B
build/shortcode/index.js 1.7 kB 0 B
build/token-list/index.js 1.24 kB 0 B
build/url/index.js 4.06 kB 0 B
build/viewport/index.js 1.74 kB 0 B
build/warning/index.js 1.13 kB 0 B
build/wordcount/index.js 1.17 kB 0 B

compressed-size-action

Copy link
Member

@vindl vindl left a comment

Choose a reason for hiding this comment

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

Nice work so far @david-szabo97! ✨

@@ -89,7 +91,10 @@ export default function Header( {
<div className="edit-site-header">
<div className="edit-site-header_start">
<MainDashboardButton.Slot>
<FullscreenModeClose />
Copy link
Member

Choose a reason for hiding this comment

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

This button is exported from the package (experimental for now) and provides a way for 3rd plugins to customize some of its parts while retaining functionality (see docs here). Given that it will no longer represent a close action, I think that we should rename the existing FullscreenModeClose to NavigationButton or DashboardButton and place our code changes there.

Copy link
Contributor

Choose a reason for hiding this comment

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

We should also figure out how to handle the FSE Navigation when not in fullscreen mode, where we wouldn't have the WP/Site Icon back button anymore.

Copy link
Member

Choose a reason for hiding this comment

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

Good point @Copons! I don't consider it a blocker for this PR though, as it's something that we can figure out later.

packages/edit-site/src/components/editor/index.js Outdated Show resolved Hide resolved
packages/edit-site/src/components/editor/index.js Outdated Show resolved Hide resolved
@david-szabo97 david-szabo97 force-pushed the try/navigation-component-in-site-editor branch from a766d9e to faeff3d Compare September 22, 2020 11:32
@david-szabo97
Copy link
Member Author

#25507 is merged so I did a rebase. Updated the description with the new screenshots.

@vindl
Copy link
Member

vindl commented Sep 22, 2020

@shaunandrews I have a question about the intended behavior here. Opening the inserter will close the navigation sidebar and vice versa in present version. Is that fine or should it be possible for both sidebars to be open at the same time?

Also, how should it interact with potential Persistent block navigator panel?

@david-szabo97
Copy link
Member Author

david-szabo97 commented Sep 22, 2020

  • Extracted left sidebar components (LeftSidebar, InserterPanel, NavigationPanel)
  • Added a temporary NavigationItem to the NavigationPanel which points to the dashboard
  • Renamed NavigationButton to DashboardButton and removed FullscreenModeClose

@david-szabo97 david-szabo97 changed the title [WIP] Site Editor: Use navigation component Site Editor: Add navigation panel with placeholder content Sep 22, 2020
Copy link
Member

@vindl vindl left a comment

Choose a reason for hiding this comment

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

Thanks @david-szabo97! This looks like a good starting point for our upcoming iteratons.

@@ -0,0 +1,42 @@
.edit-site-dashboard-button_wrapper {
Copy link
Contributor

@Copons Copons Sep 23, 2020

Choose a reason for hiding this comment

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

Please note that we should use a "loose BEM" naming.
Modifier should be preceded by a double underscore.
E.g. .edit-site-dashboard-button__wrapper

(There are a few other occurrences of this in the PR, but I'll leave you the fun of finding them 😛 )

Copy link
Member Author

Choose a reason for hiding this comment

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

I was confused by FullscreenModeClose because that component is not following the BEM. 🤔 Thanks for letting me know, fixed it up!

<DashboardButton
isOpen={ isNavigationOpen }
onClick={ onToggleNavigation }
/>
Copy link
Contributor

Choose a reason for hiding this comment

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

I've got a few doubts about this change.
While it's true that this button doesn't close fullscreen mode anymore, it also doesn't navigate back to the dashboard (so the "Open dashboard" label in the component is misleading) — and it's not even technically just a button 😄.

What it does now is to toggle the navigation sidebar, so I'd be more inclined in calling it NavigationPanelToggle.


I think we could also keep FullscreenModeClose.
While it would be left unused in this PR, we could update it to become (be?) the actual "dashboard button".
Consumers relying on it would not break, and we could use it inside the navigation toggle, or in the navigation itself (or wherever we see fit).

Either way, my opinion is that we should probably avoid removing existing components from an experimental PR whose purpose is to be a starting point, and not the finished product.

Copy link
Member

Choose a reason for hiding this comment

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

I agree that that name is more appropriate. Also no objections to keeping the FullscreenModeClose if we are going to repurpose it and include it in navigation.

Copy link
Contributor

@Copons Copons Sep 23, 2020

Choose a reason for hiding this comment

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

My point is also that the navigation sidebar is still in flux, and I'm not super keen on removing an established component (albeit experimental).
We might end up not using it, or heavily modifying it, but let's care about that when we'll be actually working on the back navigation. 🙂

Copy link
Member Author

Choose a reason for hiding this comment

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

  • Renamed DashboardButton to NavigationToggle
  • Reverted FullscreenModeClose component, let's keep it for now and we will iterate upon it

@david-szabo97 david-szabo97 force-pushed the try/navigation-component-in-site-editor branch from 0d2d6b6 to 76d897b Compare September 23, 2020 12:30
Copy link
Contributor

@Copons Copons left a comment

Choose a reason for hiding this comment

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

This LGTM!
Thank you @david-szabo97 for working on this! ✨

I'll open an issue for future discussion of the FullscreenModeClose destiny.

Copy link
Contributor

@mattwiebe mattwiebe left a comment

Choose a reason for hiding this comment

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

This looks good to me. Left one piece of feedback that we can address in a renaming PR but nothing to block this.

import InserterPanel from './inserter-panel';
import NavigationPanel from './navigation-panel';

const LeftSidebar = ( { content, setContent } ) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Not a blocker, but we should rename LeftSidebar (and any other left prefix) to something more semantic. This will be a Right sidebar on RTL sites and more of a drawer (or something) on small screens. Material design uses "side sheet" for a similar concept. We could also just simply call it Sidebar (or NavSidebar) and drop "left" altogether.

@david-szabo97 david-szabo97 merged commit 50d996a into master Sep 24, 2020
@david-szabo97 david-szabo97 deleted the try/navigation-component-in-site-editor branch September 24, 2020 09:30
@github-actions github-actions bot added this to the Gutenberg 9.1 milestone Sep 24, 2020
@afercia
Copy link
Contributor

afercia commented Sep 24, 2020

First observation: the W button was recently changed to accept the Site Icon set in the Customizer as a replacement for hte "W". In the block editor, a site icon looks like this:

Screenshot 2020-09-24 at 18 02 27

In the Site Editor, it looks like this 🙂 :

Screenshot 2020-09-24 at 18 02 05

where apparently there's some missing CSS.

Besides that, I'm not sure using the same UI control for different purposes on different screens is a good user experience. As a user, If I know the W button in the block editor brings me back to the Posts lists, I would expect the same button in the Site editor to do the same.

@afercia
Copy link
Contributor

afercia commented Sep 24, 2020

Worth also noting the "sliding in sidebar" pattern is undergoing discussion by the accessibility team as it's a pattern that introduces various accessibility issues. It does relate to other new sidebars as well though so it's not specific to this PR. An audit is going to be made on the issue related to the main Inserter, that was already identified by the accessibility team as an accessibility regression in WordPress 5.5 compared to the implementation in 5.4. See #24975

@Copons
Copy link
Contributor

Copons commented Sep 24, 2020

@afercia Thanks for chiming in!
The site icon size bug will be fixed in #25622.

The plan here was to merge the sidebar in the Site Editor in order to work on it in a real scenario, but still "protected" by the fact that it's an experimental environment.

We have been rushing this PR in because we (as in: people working on the Site Editor) are trying to improve the whole UX, which is arguably not very good right now.
One of the steps is to move the template switcher out of the header toolbar and into this sidebar. This will unblock other unrelated work that needs more room in the header toolbar, while keeping the template switching functionality available.

Thank you for linking that accessibility issue.
Admittedly, I haven't had time to look into it (I'm not an a11y expert, so it will take some time 🙂), but I promise we'll get to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Navigation Component A navigational waterfall component for hierarchy of items.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants