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

Always show icon in block toolbar #11600

Merged
merged 1 commit into from
Nov 9, 2018

Conversation

jorgefilipecosta
Copy link
Member

Closes: #11552

This PR applies a change to the block switcher now when a single block is selected it renders the block icon disabled and without the arrow or hover effect as discussed in #11552.

How has this been tested?

Verify that the icon of the columns block or "Media & Text" correctly appears.

Screenshots

screenshot 2018-11-07 at 18 23 52

screenshot 2018-11-07 at 18 24 14

@jorgefilipecosta jorgefilipecosta added [Type] Task Issues or PRs that have been broken down into an individual action to take [Feature] Blocks Overall functionality of blocks labels Nov 7, 2018
@jorgefilipecosta jorgefilipecosta added this to the 4.3 milestone Nov 7, 2018
@chrisvanpatten
Copy link
Contributor

chrisvanpatten commented Nov 7, 2018

You beat me! 😂

@jasmussen
Copy link
Contributor

Screenshots:

screenshot 2018-11-07 at 20 02 12

screenshot 2018-11-07 at 20 02 50

screenshot 2018-11-07 at 20 02 56

Generally, I dig it! This works.

Can we make sure that the icon button is always as wide as it would be, if it was a switcher? I think we may need to set a fixed width on both, though I think the one that has a transformation maybe already has a transform.

Should we also try and dimming the opacity to .8 to imply it's disabled?

CC: @alexislloyd for thoughts.

@alexislloyd
Copy link
Contributor

Let's try the 0.8 opacity to address @youknowriad's comment on #11552 and see what that looks like?

If you take a look at the screenshot on the PR, it's not easy to say that it's not a button (it doesn't do anything) and it's not easy to say that it's not just another alignment option.

@jorgefilipecosta jorgefilipecosta force-pushed the update/always-show-block-icon-on-the-switcher branch from 5dd712e to dc6efd3 Compare November 8, 2018 11:05
@gziolo
Copy link
Member

gziolo commented Nov 8, 2018

Should we also include this icon when editing as HTML? It should be a separate PR if that makes sense. We would also need to add back button in that mode as discussed on Slack https://wordpress.slack.com/archives/C02QB2JS7/p1541435807626300.

This is how the same Vimeo block looks when editing as HTML:
screen shot 2018-11-08 at 12 08 23

@jorgefilipecosta
Copy link
Member Author

Hi @jasmussen and @alexislloyd thank you for the reviews the feedback was applied and the width and opacity were changed:
screenshot 2018-11-08 at 11 04 49
screenshot 2018-11-08 at 11 04 34

@jasmussen
Copy link
Contributor

I dig that the icon box is now the same width as the switcher.

I'm wondering if the .8 opacity isn't too little. For actually disabled buttons, we go as far as 0.3:

screenshot 2018-11-08 at 12 30 50

But I'm not sure if that will look extra broken, or whether that is actually helpful.

@jorgefilipecosta jorgefilipecosta force-pushed the update/always-show-block-icon-on-the-switcher branch from dc6efd3 to 8ed3401 Compare November 8, 2018 11:50
@jorgefilipecosta
Copy link
Member Author

Hi @jasmussen we are now using the default opacity value for disabled buttons 0.3:

screenshot 2018-11-08 at 11 50 46

screenshot 2018-11-08 at 11 50 36

I think this looks better and makes it easy to understand the button is disabled.

@jasmussen
Copy link
Contributor

I think I agree, that makes sense. But I will defer to @mtias and @alexislloyd as I know they have thoughts on this.

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.

LGTM code wise.

@chrisvanpatten
Copy link
Contributor

chrisvanpatten commented Nov 8, 2018

I don't think the opacity should be adjusted at all. For starters it almost definitely won't past a contrast test, and even though the button is disabled it still needs to be usable as an indication of the block's type.

At that opacity it also looks like something is potentially wrong with the block, or something isn't fully loaded or something. It just feels like something is off.

If we continue showing the dropdown arrow, maybe there's an argument to be made for the opacity change, but as we're already hiding the arrow I don't feel like the opacity change adds anything, and in fact is detrimental.

@youknowriad
Copy link
Contributor

@chrisvanpatten How do you address this point

If you take a look at the screenshot on the PR, it's not easy to say that it's not a button (it doesn't do anything) and it's not easy to say that it's not just another alignment option.

@gziolo
Copy link
Member

gziolo commented Nov 9, 2018

Can we get this in and open a follow-up PR if we find a better way to signal that this icon is non-actionable?

@jasmussen
Copy link
Contributor

It's worth noting that if a button truly is disabled, it doesn't have to meet contrast ratio requirements. In fact it needs to be visibly disabled. This is a gray area, admittedly, because it's not a button that's disabled. But it more or less acts as the same, and the distinction is largely intellectual.

@youknowriad
Copy link
Contributor

For the sake of iteration and releasing 4.3 I'm merging but please let the discussion continue and improve on what we have if we find a better alternative.

@youknowriad youknowriad merged commit b9c909f into master Nov 9, 2018
@youknowriad youknowriad deleted the update/always-show-block-icon-on-the-switcher branch November 9, 2018 08:14
@@ -58,7 +58,20 @@ export class BlockSwitcher extends Component {
const hasStyles = blocks.length === 1 && get( blockType, [ 'styles' ], [] ).length !== 0;

if ( ! hasStyles && ! possibleBlockTransformations.length ) {
return null;
if ( blocks.length > 1 ) {
Copy link
Member

@aduth aduth Jan 3, 2019

Choose a reason for hiding this comment

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

Why do we care about whether there's a multi-selection here, when in the rendering of the IconButton below this outer if block, we use blockType.icon (the first selected block's icon) whether or not it's a multi-selection.

Arrived here via rebasing of #12828, where this code is problematic and difficult to resolve due to the inconsistent forking logic.

Copy link
Member

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Blocks Overall functionality of blocks [Type] Task Issues or PRs that have been broken down into an individual action to take
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants