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 Navigation block placeholder #27018

Merged
merged 8 commits into from
Dec 3, 2020
Merged

Update Navigation block placeholder #27018

merged 8 commits into from
Dec 3, 2020

Conversation

mkaz
Copy link
Member

@mkaz mkaz commented Nov 16, 2020

Description

Switch larger standard placeholder to inline menu that fits in more places. This updates the overall placeholder when the block is first inserted. There is a related PR here that updates the empty state when a menu is inserted #26947

Fixes #23207

How has this been tested?

  • Add Navigation block both horizontal and vertical
  • Add with/without existing Pages
  • Add with/without existing Menus
  • Confirm adding Pages, Menus, and Links work

Types of changes

  • Switches away from standard Placeholder
  • Moves actions from one menu to multiple inline actions

navigation-placeholder

TODO

  • One issue to fix still: the horizontal and vertical type isn't working in editor, but it does work for the menu.

@mkaz mkaz added the [Block] Navigation Affects the Navigation Block label Nov 16, 2020
@mkaz mkaz marked this pull request as draft November 16, 2020 22:14
@github-actions
Copy link

github-actions bot commented Nov 16, 2020

Size Change: +33 B (0%)

Total Size: 1.19 MB

Filename Size Change
build/block-library/editor-rtl.css 9.07 kB +193 B (2%)
build/block-library/editor.css 9.07 kB +192 B (2%)
build/block-library/index.js 148 kB -352 B (0%)
ℹ️ View Unchanged
Filename Size Change
build/a11y/index.js 1.14 kB 0 B
build/annotations/index.js 3.8 kB 0 B
build/api-fetch/index.js 3.42 kB 0 B
build/autop/index.js 2.84 kB 0 B
build/blob/index.js 665 B 0 B
build/block-directory/index.js 8.72 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.2 kB 0 B
build/block-editor/style.css 11.2 kB 0 B
build/block-library/style-rtl.css 8.34 kB 0 B
build/block-library/style.css 8.34 kB 0 B
build/block-library/theme-rtl.css 789 B 0 B
build/block-library/theme.css 790 B 0 B
build/block-serialization-default-parser/index.js 1.88 kB 0 B
build/block-serialization-spec-parser/index.js 3.06 kB 0 B
build/blocks/index.js 48.1 kB 0 B
build/components/index.js 172 kB 0 B
build/components/style-rtl.css 15.3 kB 0 B
build/components/style.css 15.3 kB 0 B
build/compose/index.js 9.95 kB 0 B
build/core-data/index.js 15.2 kB 0 B
build/data-controls/index.js 827 B 0 B
build/data/index.js 8.98 kB 0 B
build/date/index.js 11.2 kB 0 B
build/deprecated/index.js 768 B 0 B
build/dom-ready/index.js 571 B 0 B
build/dom/index.js 4.95 kB 0 B
build/edit-navigation/index.js 11.1 kB 0 B
build/edit-navigation/style-rtl.css 881 B 0 B
build/edit-navigation/style.css 885 B 0 B
build/edit-post/index.js 306 kB 0 B
build/edit-post/style-rtl.css 6.49 kB 0 B
build/edit-post/style.css 6.47 kB 0 B
build/edit-site/index.js 24.1 kB 0 B
build/edit-site/style-rtl.css 4.06 kB 0 B
build/edit-site/style.css 4.06 kB 0 B
build/edit-widgets/index.js 26.3 kB 0 B
build/edit-widgets/style-rtl.css 3.13 kB 0 B
build/edit-widgets/style.css 3.13 kB 0 B
build/editor/editor-styles-rtl.css 476 B 0 B
build/editor/editor-styles.css 478 B 0 B
build/editor/index.js 43.6 kB 0 B
build/editor/style-rtl.css 3.85 kB 0 B
build/editor/style.css 3.84 kB 0 B
build/element/index.js 4.63 kB 0 B
build/escape-html/index.js 735 B 0 B
build/format-library/index.js 6.86 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 2.27 kB 0 B
build/html-entities/index.js 623 B 0 B
build/i18n/index.js 3.57 kB 0 B
build/is-shallow-equal/index.js 698 B 0 B
build/keyboard-shortcuts/index.js 2.54 kB 0 B
build/keycodes/index.js 1.93 kB 0 B
build/list-reusable-blocks/index.js 3.1 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.31 kB 0 B
build/notices/index.js 1.82 kB 0 B
build/nux/index.js 3.42 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.56 kB 0 B
build/primitives/index.js 1.43 kB 0 B
build/priority-queue/index.js 791 B 0 B
build/redux-routine/index.js 2.84 kB 0 B
build/reusable-blocks/index.js 2.92 kB 0 B
build/rich-text/index.js 13.4 kB 0 B
build/server-side-render/index.js 2.77 kB 0 B
build/shortcode/index.js 1.69 kB 0 B
build/token-list/index.js 1.27 kB 0 B
build/url/index.js 2.84 kB 0 B
build/viewport/index.js 1.86 kB 0 B
build/warning/index.js 1.14 kB 0 B
build/wordcount/index.js 1.22 kB 0 B

compressed-size-action

@jasmussen
Copy link
Contributor

Before:

Screenshot 2020-11-23 at 09 58 53

After:

after

This is a massive step in the right direction, but needs some design love. I'm going to push some things to try and get us closer to what Shaun suggests in #23207 (comment).

@jasmussen jasmussen force-pushed the try/23207-nav-placeholder branch from 555ab53 to de585b8 Compare November 23, 2020 09:02
@jasmussen
Copy link
Contributor

I pushed some tweaks to:

  • Create an unselected and selected state of the placeholder.
  • Make the unselected state contain skeleton items.
  • Polish the selected state.

It now looks like this:

nav

Props to @shaunandrews for the design he created in #23207 (comment). I think it works really well, and I can think of no better way to try this than in the plugin proper.

It if works well, I would like us to explore how we can make this skeleton setup state a bit more generic, so it's easier to create on a per block basis. It seems like with a little clever component work, all of the unselected/selected, and the white box with a horizontal row of buttons/dropdowns, can be made pretty easily replicable.

A next step for me is to make this setup state aware of whether the navigation block is horizontal or vertical. Stay tuned.

@jasmussen
Copy link
Contributor

Pushed a fix to make the placeholder state orientation aware:

orientation

But I'm not quite feeling it. The shift is rather jarring. I'm going to continue to tinker with this one.

@jasmussen
Copy link
Contributor

The placeholder state with semi transparent currentColor works well in other-color themes, btw:

Screenshot 2020-11-23 at 13 56 27

@jasmussen
Copy link
Contributor

Alright, I think it's in a pretty good place now:

status

I would appreciate eyes on the code, and good testing!

@mkaz mkaz marked this pull request as ready for review November 23, 2020 16:07
@mkaz mkaz requested review from nerrad and ntwb as code owners November 23, 2020 17:35
@jasmussen
Copy link
Contributor

Cc @youknowriad @gziolo @karmatosed, I'd appreciate code and design reviews on this as some of our american friends are out for a well deserved break.

@gziolo
Copy link
Member

gziolo commented Nov 24, 2020

I didn't look at the code yet, but my concern is that it too much resembles the navigation menu that I would be fine to see on the frontend. Shouldn't it be more invitational to take some action?

Edit: Ignore my comment, I saw screencasts shared by @jasmussen :)

@gziolo gziolo requested a review from getdave November 24, 2020 16:03
Copy link
Member

@gziolo gziolo left a comment

Choose a reason for hiding this comment

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

There are all e2e tests removed related to this block. I would defer to @getdave and @talldan who co-authored them to decide whether it is possible to refactor them to work with the current workflow. It definitely would be beneficial to have user-facing tests to avoid future regressions. Other than that, I don't have any concerns regarding the proposed changes. Nice improvement 💯

packages/block-library/src/navigation/edit.js Outdated Show resolved Hide resolved
@mkaz mkaz force-pushed the try/23207-nav-placeholder branch from a97e8f2 to bca5c9a Compare December 1, 2020 19:51
@talldan
Copy link
Contributor

talldan commented Dec 2, 2020

Most of the existing end to end tests were for the placeholder, so I can understand they'd need some updating. The new placeholder seems pretty much the same in functionality but different (and a nice improvement) in presentation, so it feels like the tests still have validity.

In the commit description that removed the tests:

I tried simply bypassing the tests leaving them around to update later,
however using return true or commenting out made the linters complain
too much about unused code and defined functions that are not used.

The file can be restore when needed.

@mkaz My concern with removing the whole file is that while it's easy to bring back, it might just be forgotten, and there's some handy code in the file for mocking the endpoints that will be very useful.

I reckon it'd be nice to leave in place something simpler and it.skip the more complex ones if they're challenging to update. While there's an eslint rule against skipping tests, I think it'd be ok for an experimental block, and would just require an eslint-disable. What do you think @gziolo?

edit: Just noticed the eslint rule is only a warning—probably a reminder not to leave a test skipped in the long term, so probably ok to skip anything challenging to update.

@mkaz
Copy link
Member Author

mkaz commented Dec 2, 2020

it.skip

TIL 😀

@mkaz mkaz force-pushed the try/23207-nav-placeholder branch from bca5c9a to a973035 Compare December 2, 2020 17:11
mkaz and others added 3 commits December 3, 2020 08:08
- Remove standard Placeholder
- Break apart menu and create new as individual actions
- Move all pages to own action
@mkaz mkaz force-pushed the try/23207-nav-placeholder branch from a973035 to 3ebc40e Compare December 3, 2020 16:08
Copy link
Contributor

@jasmussen jasmussen left a comment

Choose a reason for hiding this comment

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

This is a big step in the right direction, and very worth trying out and following up on.

@mkaz mkaz merged commit 0468fc8 into master Dec 3, 2020
@mkaz mkaz deleted the try/23207-nav-placeholder branch December 3, 2020 19:20
@github-actions github-actions bot added this to the Gutenberg 9.6 milestone Dec 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Navigation Affects the Navigation Block
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Navigation Block: Reconsider placeholder state
5 participants