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

Polish tertiary actions, switches, save state #10552

Merged
merged 12 commits into from
Oct 18, 2018
Merged

Conversation

jasmussen
Copy link
Contributor

This PR does a few things. I know how you so love those, @mtias.

First, it tweaks the save draft/switch to draft area:

save draft

switch

This addresses feedback from #10415, #9452, #9455.

Secondly, it makes the "Trash" button into a normal button, but colored red:

screenshot 2018-10-12 at 14 35 13

This is part of ongoing "align things to a grid" efforts, and sort of reduces the cognitive load of the whole panel.

Thirdly, it moves the switch to the left of the label:

screenshot 2018-10-12 at 14 45 13

This is also part of those "align things to a grid" efforts, as we generally have both icons, checkboxes, and other items to the left of labels. Now the wwitch is too.

Your thoughts are appreciated.

@jasmussen jasmussen added [Type] Enhancement A suggestion for improvement. Needs Design Feedback Needs general design feedback. labels Oct 12, 2018
@jasmussen jasmussen added this to the 4.1 milestone Oct 12, 2018
@jasmussen jasmussen self-assigned this Oct 12, 2018
@jasmussen jasmussen requested a review from a team October 12, 2018 12:49
@youknowriad
Copy link
Contributor

I love the consistency it brings to the "Save draft" and the "Switch to draft" buttons. Also, I like that the distinction between those buttons and the "saved" state is more visible.

Design wise, I prefer the new trash button over the link we had.

Just a small note on the PR, I'd have preferred separate PRs for each part (save draft, trash button and the toggles) as they seem not related, it eases reviews.

@youknowriad
Copy link
Contributor

Question? What about mobile? Do we still show a "save" icon on mobile?

@jasmussen
Copy link
Contributor Author

jasmussen commented Oct 12, 2018

Just a small note on the PR, I'd have preferred separate PRs for each part (save draft, trash button and the toggles) as they seem not related, it eases reviews.

I did it again, didn't I? I officially owe Matías a milkshake. Sorry about that.

Question? What about mobile? Do we still show a "save" icon on mobile?

Yes, that icon is simply hidden beyond the mobile viewpoint. On mobile it's still there.

I would suggest that the way to retire the cloud icon on mobile, is to improve the auto-save feature to the point where we can actually retire it as a disparate action.

@mtias
Copy link
Member

mtias commented Oct 12, 2018

I did it again, didn't I? I officially owe Matías a milkshake. Sorry about that.

I keep a notebook with all these. It's kind of full.

@aduth
Copy link
Member

aduth commented Oct 12, 2018

What is TextButton? This separation appears to move us further away from semantic improvements discussed in #7534 / #9702.

@alexislloyd
Copy link
Contributor

I would suggest that the way to retire the cloud icon on mobile, is to improve the auto-save feature to the point where we can actually retire it as a disparate action.

Agreed. In the meantime, is the issue that the cloud icon is unclear? If so, this is another material icon for saving that gets away from either the floppy disk or the cloud. Might be a solid alternative for the time being.

image

@jasmussen
Copy link
Contributor Author

In the meantime, is the issue that the cloud icon is unclear? If so, this is another material icon for saving that gets away from either the floppy disk or the cloud. Might be a solid alternative for the time being.

Yes, there's an issue being discussed here: #9455

Merging this PR will actually close that issue, but be sure to reopen it if need be.

@jasmussen
Copy link
Contributor Author

@aduth

What is TextButton? This separation appears to move us further away from semantic improvements discussed in #7534 / #9702.

Good points.

For now, I've retired the new separate TextButton component, and instead made it a isText prop.

I think the semantic aspects you bring up in those two tickets make sense, and the "link" prop should probably be retired. But I also think there's value in having three levels of importance for the buttons — primary, secondary, tertiary — but otherwise be relatively identical in function.

How do you feel about the isText prop?

@aduth
Copy link
Member

aduth commented Oct 12, 2018

Forcing myself into a perspective of ignorance by avoiding looking at the context in which it's implemented: I have no idea what is implied in a "text variation" of a button.

Is it similar to how we have an optional link aesthetic (cosmetic) to a button? If so, what's the difference between it and being a disabled link?

To me, text is not interactable, so the idea of a text button is paradoxical.

@aduth
Copy link
Member

aduth commented Oct 12, 2018

But I also think there's value in having three levels of importance for the buttons — primary, secondary, tertiary

So why not reflect this in the prop name, e.g. isPrimary, isSecondary, isTertiary, rather than its visual appearance, which as best I can tell is an incidental detail.

@mtias
Copy link
Member

mtias commented Oct 12, 2018

I'm not sure there is a tertiary / secondary distinction there, but could work.

@aduth
Copy link
Member

aduth commented Oct 12, 2018

In any case, we already have an isPrimary prop for Button, which should be reconciled for consistency if we're going to opt for prop naming by appearance than by semantic purpose / hierarchy.

@mtias
Copy link
Member

mtias commented Oct 12, 2018

We should definitely clear these component semantics.

@jasmussen
Copy link
Contributor Author

There are a few layers to it. The plain "text" button is a concept widely used in mobile contexts as well, for an action that isn't a hyperlink but also isn't super important. It's often referred to there as a Text Button. See also https://material.io/design/components/buttons.html#usage.

But I like the idea of calling it tertiary, and I wouldn't be opposed to exploring ways to make it look less like a hyperlink. This could involve bolder text, or a different color — though I really do like that the color is the same as the color used on the Primary button.

@ZebulanStanphill
Copy link
Member

Secondly, it makes the "Trash" button into a normal button, but colored red:
image

I don't like this. Move to trash is a link, so it should be styled like one. We should be moving towards more semantic distinction between buttons and links, not confusing them more.

Speaking of which, the clickable values for Visibility and Publish are styled like links, but they are buttons. I think they should be changed to look like what you have made Save Draft look like.

Other than that, I think I like these changes.

@youknowriad
Copy link
Contributor

I don't like this. Move to trash is a link, so it should be styled like one.

Actually, I had the same impression but after checking, it's a button not a link, it doesn't have any "href".

@ZebulanStanphill
Copy link
Member

@youknowriad Huh, you're right. It's actually a <button>. I guess the style change is fine, then.

@jasmussen jasmussen requested a review from karmatosed October 13, 2018 14:32
@robertdall
Copy link

robertdall commented Oct 13, 2018

In the meantime, is the issue that the cloud icon is unclear? If so, this is another material icon for saving that gets away from either the floppy disk or the cloud. Might be a solid alternative for the time being.

Yes, there's an issue being discussed here: #9455

Merging this PR will actually close that issue, but be sure to reopen it if need be.

The #9455 hasn't been resolved yet and I hesitate to use anything that looks like a download/cloud button as we are not downloading anything we are saving the post to the server, not the user's device.

Copy link
Member

@karmatosed karmatosed left a comment

Choose a reason for hiding this comment

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

From a design perspective let's get this approved. One point I am on fence about is the trash as a button. I agree with taking away the icon but as far as making a button goes, this isn't the same as other places in WP core. However, we can have this in if people agree it's the right route forward. I do agree with removing the icon though.

Assuming we have the button in for trash, potentially we need to explore other places for this to bring in over time.

@karmatosed karmatosed removed the Needs Design Feedback Needs general design feedback. label Oct 15, 2018
@gziolo
Copy link
Member

gziolo commented Oct 16, 2018

This PR has one failing unit test and needs to be rebased.

@talldan
Copy link
Contributor

talldan commented Oct 17, 2018

@jasmussen Cool - I've pushed a commit (3d08150) that does that. It should be easily reverted if there's a change of opinion.

@youknowriad
Copy link
Contributor

So this means there's no "icon" in mobile which was an explicit decision because the "Save Draft" label might be long in some languages. I just want to make sure that we're doing this on purpose :)

@jasmussen
Copy link
Contributor Author

Oh I'm sorry the save icon should be there on mobile and only mobile, like before

@@ -40,7 +40,7 @@ class ToggleControl extends Component {

return (
<BaseControl
label={ label }
label={ heading }
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure I understand why we need the changes in this component? cc @jasmussen ?

Copy link
Contributor

Choose a reason for hiding this comment

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

If my assumption is correct you wanted to align the label at the right so you duplicated it and passed something inexisting to the parent component? I tweaked the component and use order CSS instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Are we sure the order property is kosher, tab direction wise?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it is, since the label is not a tab stop

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍👍

@@ -4,8 +4,9 @@ $toggle-border-width: 2px;

.components-form-toggle {
position: relative;
margin-right: $grid-size-large;
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems weird to add a margin right globally too all toggles? Why do we need this?

Copy link
Contributor

Choose a reason for hiding this comment

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

I moved it to the ToggleControl style as it seems that this was specific to that component instead.

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 thing is, the label is clickable. Usually, the bigger the clickable area, the easier it is to hit and therefore the more user-friendly it is. Because this is a flex container, the setting fixed margin can stretch the element. This was why.

I can't test if the new rules achieve the same, and if they don't that's not the end of the world. Thanks for fixing. ♥️

Copy link
Contributor

Choose a reason for hiding this comment

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

Don't worry, I applied the exact same style, I just moved it elsewhere to keep the genericity of the form toggle component.

Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure how this affects the label's clickable area though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's fine, it's not visible, so it's an enhancement that can happen later.

@youknowriad youknowriad dismissed their stale review October 18, 2018 08:16

Did the necessary updates.

Copy link
Contributor

@youknowriad youknowriad left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@youknowriad
Copy link
Contributor

youknowriad commented Oct 18, 2018

Actually, I'm seeing broken styling for the "trash" button. Hold on merging, I'm looking.

Edit: It's fine, issue with my browser's cache.

@youknowriad youknowriad merged commit a0e3ee5 into master Oct 18, 2018
@youknowriad youknowriad deleted the polish/polish branch October 18, 2018 09:02
@jasmussen
Copy link
Contributor Author

🌈

One milkshake for Mr. Benguella!

🥤

@youknowriad
Copy link
Contributor

And another for @talldan :)

@jasmussen
Copy link
Contributor Author

Another one for Mr. Richards, yes!

🥤

@afercia
Copy link
Contributor

afercia commented Oct 21, 2018

I've noticed a couple things worth considering as quick improvements.

1
The "Switch to Draft" button clickable area is maybe a bit too small and it's different from the "Save Draft" button. Both buttons have a .is-tertiary class but then the "Save Draft" 8 pixels padding is defined separately in packages/editor/src/components/post-saved-state/style.scss. Instead, the "Switch to Draft" button doesn't have this padding.

screen shot 2018-10-21 at 12 02 34

screen shot 2018-10-21 at 12 03 34

Will leave this to the better knowledge of @jasmussen

2

Thirdly, it moves the switch to the left of the label:

This change allows now to address a long standing issue with the toggle control. Under the hood, it uses a <checkbox> element and a label. Checkboxes should always come first and be followed by their labels in the DOM order. Changing the visual order with the flexbox order property is not ideal because visual order and DOM order don't match (see WCAG), see also https://www.w3.org/TR/css-flexbox-1/#order-accessibility

Will prepare a quick PR.

jasmussen added a commit that referenced this pull request Oct 22, 2018
This addressed feedback in #10552 (comment).

It makes the tertiary button style be born with the same hit area as a button, because it is intended to be used as such, just with a different styling.
jasmussen added a commit that referenced this pull request Oct 24, 2018
This addressed feedback in #10552 (comment).

It makes the tertiary button style be born with the same hit area as a button, because it is intended to be used as such, just with a different styling.
jasmussen added a commit that referenced this pull request Oct 25, 2018
* Fix issue with tertiary button hit areas

This addressed feedback in #10552 (comment).

It makes the tertiary button style be born with the same hit area as a button, because it is intended to be used as such, just with a different styling.

* Address feedback.

* Clarify comment.
antpb pushed a commit to antpb/gutenberg that referenced this pull request Oct 26, 2018
* Polish Save Draft/Switch to Draft area
* Use a Button for Trash button
* Polish the toggles.
antpb pushed a commit to antpb/gutenberg that referenced this pull request Oct 26, 2018
* Fix issue with tertiary button hit areas

This addressed feedback in WordPress#10552 (comment).

It makes the tertiary button style be born with the same hit area as a button, because it is intended to be used as such, just with a different styling.

* Address feedback.

* Clarify comment.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.