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

G2 visual followup #21476

Merged
merged 14 commits into from
Apr 13, 2020
Merged

G2 visual followup #21476

merged 14 commits into from
Apr 13, 2020

Conversation

jasmussen
Copy link
Contributor

@jasmussen jasmussen commented Apr 8, 2020

This PR fixes #20575 and addresses feedback, plus some more.

  • It fixes a "busy" gradient when saving reusable blocks.
  • It polishes the active state for alignments and block navigation.
  • It removes the triangle indicator from the block toolbar, because for the time being at least, we can't offset the toolbar 48px to the left in a consistent way, so its initial purpose is not yet met.
  • It removes the gray flashing below new paragraphs, as it hasn't proven itself valuable.
  • It adds animation to the toggle buttons in the block toolbar.
  • It defaults all popovers to "down and right", bringing consistency.
  • It adds 12px spacing between popover and opener, making sure popovers adhere to the visual grid.
  • It adds a new popover prop, "isPrimary", which puts the popover visually at elevation zero and shows dark borders. This is meant to be used with the block toolbar, or when you know what you're doing, and by default the popover still shows a gray border and drop shadow.

Aside from the visual considerations, I'd like feedback on the popover prop code, I'm sure I could've done that in a nicer way.

I would also love some RTL feedback on the default popover sirection, to see if we can maybe change the default per locale.

@jasmussen jasmussen added the [Status] In Progress Tracking issues with work in progress label Apr 8, 2020
@jasmussen jasmussen self-assigned this Apr 8, 2020
@jasmussen
Copy link
Contributor Author

A few screenshots of work in progress.

I tried removing the triangle, because we might not be able do the negative leftwards shift of the toolbar. Before:

triangle-before

After:

triangle-afterafter

I fixed the saving gradient. Before:

before gradient

After:

after gradient

@github-actions
Copy link

github-actions bot commented Apr 8, 2020

Size Change: -161 B (0%)

Total Size: 903 kB

Filename Size Change
build/block-editor/index.js 104 kB +72 B (0%)
build/block-editor/style-rtl.css 10.2 kB -45 B (0%)
build/block-editor/style.css 10.2 kB -42 B (0%)
build/block-library/editor-rtl.css 7.11 kB -106 B (1%)
build/block-library/editor.css 7.11 kB -106 B (1%)
build/block-library/index.js 112 kB -72 B (0%)
build/components/index.js 198 kB +27 B (0%)
build/components/style-rtl.css 16.6 kB +58 B (0%)
build/components/style.css 16.6 kB +53 B (0%)
ℹ️ View Unchanged
Filename Size Change
build/a11y/index.js 1.02 kB 0 B
build/annotations/index.js 3.62 kB 0 B
build/api-fetch/index.js 4.01 kB 0 B
build/autop/index.js 2.82 kB 0 B
build/blob/index.js 620 B 0 B
build/block-directory/index.js 6.24 kB 0 B
build/block-directory/style-rtl.css 760 B 0 B
build/block-directory/style.css 760 B 0 B
build/block-library/style-rtl.css 7.15 kB 0 B
build/block-library/style.css 7.16 kB 0 B
build/block-library/theme-rtl.css 683 B 0 B
build/block-library/theme.css 685 B 0 B
build/block-serialization-default-parser/index.js 1.88 kB 0 B
build/block-serialization-spec-parser/index.js 3.1 kB 0 B
build/blocks/index.js 57.7 kB 0 B
build/compose/index.js 6.66 kB 0 B
build/core-data/index.js 11.1 kB 0 B
build/data-controls/index.js 1.25 kB 0 B
build/data/index.js 8.43 kB 0 B
build/date/index.js 5.47 kB 0 B
build/deprecated/index.js 772 B 0 B
build/dom-ready/index.js 569 B 0 B
build/dom/index.js 3.1 kB 0 B
build/edit-navigation/index.js 3.1 kB 0 B
build/edit-navigation/style-rtl.css 279 B 0 B
build/edit-navigation/style.css 280 B 0 B
build/edit-post/index.js 93.5 kB 0 B
build/edit-post/style-rtl.css 12.3 kB 0 B
build/edit-post/style.css 12.3 kB 0 B
build/edit-site/index.js 10.4 kB 0 B
build/edit-site/style-rtl.css 5.02 kB 0 B
build/edit-site/style.css 5.02 kB 0 B
build/edit-widgets/index.js 7.53 kB 0 B
build/edit-widgets/style-rtl.css 3.74 kB 0 B
build/edit-widgets/style.css 3.73 kB 0 B
build/editor/editor-styles-rtl.css 428 B 0 B
build/editor/editor-styles.css 431 B 0 B
build/editor/index.js 43.6 kB 0 B
build/editor/style-rtl.css 3.49 kB 0 B
build/editor/style.css 3.49 kB 0 B
build/element/index.js 4.64 kB 0 B
build/escape-html/index.js 733 B 0 B
build/format-library/index.js 7.29 kB 0 B
build/format-library/style-rtl.css 502 B 0 B
build/format-library/style.css 502 B 0 B
build/hooks/index.js 2.13 kB 0 B
build/html-entities/index.js 622 B 0 B
build/i18n/index.js 3.56 kB 0 B
build/is-shallow-equal/index.js 711 B 0 B
build/keyboard-shortcuts/index.js 2.51 kB 0 B
build/keycodes/index.js 1.91 kB 0 B
build/list-reusable-blocks/index.js 3.12 kB 0 B
build/list-reusable-blocks/style-rtl.css 226 B 0 B
build/list-reusable-blocks/style.css 226 B 0 B
build/media-utils/index.js 5.28 kB 0 B
build/notices/index.js 1.79 kB 0 B
build/nux/index.js 3.4 kB 0 B
build/nux/style-rtl.css 616 B 0 B
build/nux/style.css 613 B 0 B
build/plugins/index.js 2.67 kB 0 B
build/primitives/index.js 1.5 kB 0 B
build/priority-queue/index.js 789 B 0 B
build/redux-routine/index.js 2.84 kB 0 B
build/rich-text/index.js 14.8 kB 0 B
build/server-side-render/index.js 2.67 kB 0 B
build/shortcode/index.js 1.7 kB 0 B
build/token-list/index.js 1.28 kB 0 B
build/url/index.js 4.01 kB 0 B
build/viewport/index.js 1.84 kB 0 B
build/warning/index.js 1.14 kB 0 B
build/wordcount/index.js 1.17 kB 0 B

compressed-size-action

@jasmussen
Copy link
Contributor Author

Tweaked alignments. Before:

Screenshot 2020-04-08 at 10 18 49

After:

Screenshot 2020-04-08 at 10 29 28

Also did this for block navigation:

Screenshot 2020-04-08 at 10 34 26

@jasmussen
Copy link
Contributor Author

Added animation to toggle buttons:

bold appear

Unfloated the notice button to fix an issue it regressed. These notices should be redesigned separately:

Screenshot 2020-04-08 at 10 48 52

@jasmussen
Copy link
Contributor Author

Pushed a fix to set a default popover direction. This adds some much needed consistency:

down right

@jasmussen
Copy link
Contributor Author

I added spacing to popovers, and a new "isPrimary" prop to the popover which will paint it dark and at elevation zero:

primary submenus

This gets us very close to the mockups.

By default, the popover still uses the light gray shadowed treatment:

Screenshot 2020-04-08 at 12 16 35

The primary prop should only be used when the popover is in the context of block toolbar UI.

@jasmussen jasmussen added [Type] Code Quality Issues or PRs that relate to code quality Needs Design Feedback Needs general design feedback. and removed [Status] In Progress Tracking issues with work in progress labels Apr 8, 2020
@jasmussen jasmussen mentioned this pull request Apr 8, 2020
9 tasks
@ZebulanStanphill
Copy link
Member

I like the new popover styles.

The primary prop should only be used when the popover is in the context of block toolbar UI.

Why?

@jasmussen
Copy link
Contributor Author

I suppose I should've finished that sentence with "... or if you know what you're doing".

I think of it as an extension of the block toolbar, being made of the same material and being coplanar with it: extending at the same z depth layer and therefore subject to the same "physics".

When a popover is opened from the top toolbar, on the other hand, it's not the same material and it will actually overlay the toolbar itself and often, the sidebar. That beckons a higher z depth, which suggests the shadow. Extending from secondary (to the block) UI also means the dark border wouldn't connect in any meaningful way.

That's how I think about it, in any case!

@ellatrix
Copy link
Member

ellatrix commented Apr 9, 2020

Love the improvements!

What if the popover outlines were the same, and the popover was positioned slightly lower and separate from the toolbar? Probably discussed before, so sorry if I missed that. :)

@jasmussen
Copy link
Contributor Author

@ellatrix Thanks!

What if the popover outlines were the same, and the popover was positioned slightly lower and separate from the toolbar? Probably discussed before, so sorry if I missed that. :)

But that is exactly what this PR does, or am I misunderstanding?

@ellatrix
Copy link
Member

ellatrix commented Apr 9, 2020

Ooooh, perfect then!

@ellatrix
Copy link
Member

ellatrix commented Apr 9, 2020

  • It adds a new popover prop, "isPrimary", which puts the popover visually at elevation zero and shows dark borders. This is meant to be used with the block toolbar, or when you know what you're doing, and by default the popover still shows a gray border and drop shadow.

Ah, I missed this bit. Is there a need to differentiate? Why not make all popovers like this?

@jasmussen
Copy link
Contributor Author

Is there a need to differentiate? Why not make all popovers like this?

I think so, yes. I went into a little more depth in my comment to Zeb (#21476 (comment)) — but it boils down to this: by default the popover component should behave as a popover: it overlays content.

But in the specific case of popovers that extend from the block toolbar, these are so literally close to the block itself, that they are at what I would call "elevation zero". Not talking CSS z-index here, but rather something similar to Material's "elevation" principle: https://material.io/design/environment/elevation.html

Another way to think of it is just that those popovers just receive more emphasis because they are primary UI. Same principle as when you have a single Button component with an isPrimary attribute.

@@ -30,6 +30,7 @@ const DEFAULT_ALIGNMENT_CONTROLS = [

const POPOVER_PROPS = {
position: 'bottom right',
isPrimary: true,
Copy link
Member

Choose a reason for hiding this comment

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

Wonder if we should use a more descriptive name here because I don't feel primary / secondary is what should determine the weight. Maybe something like "isFloating"? Or "isBlockUi" since these are used for blocks only? Just a thought.

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'm super duper open to changing this, and now is the best time to do so. Which is your preference? We could also go in a different direction, like isEmphasized?

Copy link
Member

Choose a reason for hiding this comment

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

Maybe isAlternate for now?

@ZebulanStanphill
Copy link
Member

It seems weird to me to use shadows in some popovers but not others. When I first saw the G2 mockups, I thought we were moving away from shadows entirely and that everything would use the high contrast borders that the block toolbar uses.

It seems weird to me to use shadows in some places but not others. If some popovers are going to have shadows, why not also the toolbar? I would think of it as being at a higher elevation than the content being edited, yet it has no shadows. It seems like an inconsistency to me to use a mix of some floating elements having shadows and others not.

Also, I don't really get the idea of emphasizing certain popovers over others. All the popovers are closed by default, so different styling on one versus the other isn't really going to make a difference on where your eyes are drawn to. When you open the more menu in the top toolbar, your attention is focused on the more menu popover, so shouldn't it appear just as emphasized as any other popover?

I'm not convinced other users are going to understand why some popovers look different than others, either. Without having seen your comments, I would have assumed it was just a visual consistency bug.

That said, if others disagree with me, I'm okay with this PR merging as-is, design-wise. I'm happy to have the popovers looking more consistent with the block toolbar UI, even if it's only some of the popovers.

@jasmussen
Copy link
Contributor Author

It seems weird to me to use shadows in some popovers but not others. When I first saw the G2 mockups, I thought we were moving away from shadows entirely and that everything would use the high contrast borders that the block toolbar uses.

To quote a friend of mine: consistency is nuanced.

Honestly, the term "popover" is not one a user is likely ever going to see or even think about, it's just what the underlying component is called. The top toolbar and UI outside the canvas, the borders and separators are intentionally lighter because it is secondary UI and because it does not have to visually distinguish itself from the theme. Menus that extend from this UI are consistent with this UI.

And inside the canvas, there's the block toolbar. This UI has been designed not only to be primary, but to work in any context background:

dark-theme

text-on-backgrounds

Yes, technically alignments appear in a popover — but just like the "Parent Button" is made from toolbar material, so are the menus that extend from the toolbar.

@jasmussen
Copy link
Contributor Author

Renamed isPrimary prop to isAlternate. Also used the smaller plus for the big appender button. Looks good, props Pablo for tip:

Screenshot 2020-04-10 at 17 11 25

@jasmussen jasmussen force-pushed the try/g2-more-followup branch from 7fed8fb to 53ce532 Compare April 10, 2020 15:15
@jasmussen
Copy link
Contributor Author

Addressed feedback, rebased, updated snapshots.

I feel like this branch is in a solid solid place, and none of the disagreements feel like ones we can't revisit later on, if they turn out to be problematic. I would definitely still welcome thoughts and such, and most definitely testing. But otherwise, this is ready for final review!

Copy link
Member

@ZebulanStanphill ZebulanStanphill left a comment

Choose a reason for hiding this comment

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

Looks better than master to me. 👍

@jasmussen
Copy link
Contributor Author

Thank you Zeb. I forgot to test again RTL and the new default popover direction, so I'll test and verify that before merging.

@jasmussen
Copy link
Contributor Author

I wanted to make sure that the new default behavior for popovers to open down and rightwards was properly handled in RTL language directions. It is, it defaults to down and leftwards:

menus

In that vein, I'm going to merge this one.

I wanted to make a note that the change in #21476 (comment) to remove the triangle indicator is one that is worth revisiting if/when we look at the mover control behavior again. I consider it a delightful aspect of the G2 visuals, and one that can provide great character when it does indeed point to the left margin of the block. So I would love to restore it when we can.

@jasmussen jasmussen merged commit 505e310 into master Apr 13, 2020
@jasmussen jasmussen deleted the try/g2-more-followup branch April 13, 2020 06:19
@github-actions github-actions bot added this to the Gutenberg 7.9 milestone Apr 13, 2020
jasmussen added a commit that referenced this pull request Apr 13, 2020
Followup to #21476, which defaulted popovers to open down and right. This restores the "down and center" behavior for the inserter as used in-canvas.
jasmussen added a commit that referenced this pull request Apr 13, 2020
Followup to #21476, which defaulted popovers to open down and right. This restores the "down and center" behavior for the inserter as used in-canvas.
@mtias
Copy link
Member

mtias commented Apr 13, 2020

Nice work, Joen!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Design Feedback Needs general design feedback. [Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

G2 Block Interface followup
4 participants