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

Minuscule issues with block highlight/selection styles #27925

Closed
stokesman opened this issue Dec 30, 2020 · 6 comments · Fixed by #27968
Closed

Minuscule issues with block highlight/selection styles #27925

stokesman opened this issue Dec 30, 2020 · 6 comments · Fixed by #27968
Assignees
Labels
[Status] In Progress Tracking issues with work in progress

Comments

@stokesman
Copy link
Contributor

stokesman commented Dec 30, 2020

Here are three little things I hope we might improve upon. These are so little that they are probably best reviewed with a low DPI display or a with a magnifier for a high DPI display 🔍 .

1. Line-weight is prone to rounding inconsistencies (Firefox)

block-halos-multi-firefox-before
That's due to the use of 1.5px for the box-shadow spread-radius (aimed to match icon line-weights). IMO there's another little downside to this. Even on a browser that doesn't produce the rounding inconsistencies, the appearance of the line is soft or fuzzy (noticeable at least on common low DPI displays).

2. Part of the line is outside the block rectangle

So if the parent block hides overflow there is some clipping
block-shadow-overflow-clipped
I don't think there's a core block that this applies to. I ran across it with a custom block I'm building.

Another side to this is plain ol’ alignment. I think it's unsightly that the edge of the highlight/selected indicator almost aligns to the block toolbar. (In the above graphic it does align due to the clipping. The graphic in the next section does show the almost alignment.)

3. Corners are too round

The “outline” is drawn with the box-shadow property and, being drawn outset to the box, would naturally have a larger radius. In the current styles, there is an attempt to compensate which reduces the border-radius from 2px to 1px.

border-radius: $radius-block-ui - $border-width; // Border is outset, so so subtract the width to achieve correct radius.

Yet that still produces an overly round corner. Here's a graphic with some magnified portions to demonstrate the actual border-radius rendered and from left to right is the current style, then subsequent reductions in border-radius to achieve a rendered 2px radius (viewed in Google Chrome)

block-shadow-radius-correction
That's way more compensation than I expected and not something that can be easily derived from the available variables. This is not a recommendation to use a 0.075px border-radius.

To be continued...

I'll be making a PR with resolutions for these issues but both the 1st and the 3rd have parallels in other parts of the UI and could use follow-ups if these issues are deemed worthy of addressing.

@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Dec 30, 2020
@jasmussen
Copy link
Contributor

Great ticket, and important one, thanks again. Really appreciate your help here.

The rounding issue, I'd say, is the most urgent one to solve. I responded on your PR with some thoughts.

  1. Part of the line is outside the block rectangle
  2. Corners are too round

In your screenshot, the selection style is black. Is that a separate WP-admin color scheme? Is it in the post or site editor?

I'm primarily asking for clarification because both the line-outside-the-rectangle and roundness of the corners have been intentionally designed around the placeholder box:

screencast 2021-01-04 11-28-56

As you can see in that GIF, the empty placeholder box has a 1px dark border with 2px radius, exactly like the block toolbar. And when focused, the blue selection indicator is placed exactly on top of that 1px border. It does grow outwards rather than inwards, which visually seems to affect the radius (the outside radius appears bigger). That's something we can revisit of course, but in the situation where we have to go full 2px with the border radius (in case I can't get this fix to work), it feels less heavy than going inwards:

Screenshot 2021-01-04 at 11 17 14

@jasmussen
Copy link
Contributor

I created #27968 to try the above media query idea. It seems to work okay?

@stokesman
Copy link
Contributor Author

Joen, Thanks for the extra info on this. I'd agree that only the rounding issue seems crucial.

In your screenshot, the selection style is black. Is that a separate WP-admin color scheme? Is it in the post or site editor?

It's the Coffee admin color scheme and in the Post Editor.

@jasmussen
Copy link
Contributor

It's the Coffee admin color scheme and in the Post Editor.

Awesome. It seems like the accent color is worth iterating as part of https://core.trac.wordpress.org/ticket/49999, so it has contrast to black.

@shaunandrews
Copy link
Contributor

It does grow outwards rather than inwards, which visually seems to affect the radius (the outside radius appears bigger).

Visually, I think the "grow inwards" option actually works better.

But affecting the display inside the block will likely lead to obscuring the content of the block, as you can see in the image Joen posted above — the outline overlaps the text. I think this should be avoided.

So I think the "grow outwards" option better, even if it causes some visual discord with the block toolbar.

--

I wanted to suggest looking at different treatments for outline states, perhaps keeping a 1px border and using dotted, dashed, and solid line styles — but I know the current thick, blue border is supposed to relate to the standard :focus indicator throughout the rest of the UI.

@jasmussen
Copy link
Contributor

Whether inset, outset, or both at the same time, one key thing to keep in mind is fullwide blocks, like this:

Screenshot 2021-01-06 at 11 08 25

If the block is truly edge-to-edge, then only an inset style will still be visible there.

That in turn needs to be balanced against this:

Screenshot 2021-01-06 at 11 09 35

The more inset it is, the more it covers the content.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Status] In Progress Tracking issues with work in progress
Projects
None yet
3 participants