-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Conversation
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. |
Question? What about mobile? Do we still show a "save" icon on mobile? |
I did it again, didn't I? I officially owe Matías a milkshake. Sorry about that.
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. |
I keep a notebook with all these. It's kind of full. |
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. |
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. |
Good points. For now, I've retired the new separate 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? |
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. |
So why not reflect this in the prop name, e.g. |
I'm not sure there is a tertiary / secondary distinction there, but could work. |
In any case, we already have an |
We should definitely clear these component semantics. |
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. |
Actually, I had the same impression but after checking, it's a button not a link, it doesn't have any "href". |
@youknowriad Huh, you're right. It's actually a |
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. |
There was a problem hiding this 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.
This PR has one failing unit test and needs to be rebased. |
@jasmussen Cool - I've pushed a commit (3d08150) that does that. It should be easily reverted if there's a change of opinion. |
a1d4fd5
to
3d08150
Compare
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 :) |
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 } |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
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. |
🌈 One milkshake for Mr. Benguella! 🥤 |
And another for @talldan :) |
Another one for Mr. Richards, yes! 🥤 |
I've noticed a couple things worth considering as quick improvements. 1 Will leave this to the better knowledge of @jasmussen 2
This change allows now to address a long standing issue with the toggle control. Under the hood, it uses a Will prepare a quick PR. |
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.
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.
* 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.
* Polish Save Draft/Switch to Draft area * Use a Button for Trash button * Polish the toggles.
* 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.
This PR does a few things. I know how you so love those, @mtias.
First, it tweaks the save draft/switch to draft area:
This addresses feedback from #10415, #9452, #9455.
Secondly, it makes the "Trash" button into a normal button, but colored red:
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:
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.