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 focus and active styles, and do cleanups #8385

Merged
merged 3 commits into from
Aug 6, 2018

Conversation

jasmussen
Copy link
Contributor

@jasmussen jasmussen commented Aug 2, 2018

This PR does three things:

  1. It fixes a regression with the :active style for buttons. Now it works again:

active

  1. It replaces in a whole SLEW of files, the use of 1px for border widths, to use an SCSS variable. This is a cleanup job suggested by @tofumatt, and shouldn't affect anything. I don't expect we'll ever actually want to change the value of the $border-width, but by using a SCSS variable, we can make complex SCSS math easier to understand. For example 832a6c1#diff-b40a015680110faaabe748b80f5b4cc9L32 no longer needs an HTML comment.

  2. It redesigns input fields. This is what needs design feedback. Before they were square and ligth gray, now they are rounded and darker, which fixes Some input boundaries lack sufficient contrast #7053. I also changed the focus style to be bolder — this may feel heavier at first hand, but with the darker base input style I felt like this was the only way to give contrast between base and focus style. This also fixes any issues with showing input fields on gray backgrounds, as noted in Some input boundaries lack sufficient contrast #7053 (comment).

new focus styles

embed

At first glance these new styles might feel a bit too heavy handed, but after a little while the reduced amount of color in the focus style actually comes across as simpler. Give it a little while to work on you.

@jasmussen jasmussen added [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). Needs Design Feedback Needs general design feedback. labels Aug 2, 2018
@jasmussen jasmussen self-assigned this Aug 2, 2018
@jasmussen jasmussen requested review from a team and karmatosed August 2, 2018 10:28
@afercia
Copy link
Contributor

afercia commented Aug 2, 2018

3, the darker border for input fields is very welcomed from an accessibility perspective, pending design feedback. In #7053 / #8037 a different solution is explored (darkening only the bottom border), which honestly I personally don't like that much.

With regards to this PR, I have only one consideration so far: the comment
// Lightest gray that can be used for AAA contrast.

is a bit misleading for two reasons: it's AA level and 3:1 is the minimum contrast for non-text. So it should be changed to:
// Lightest gray that can be used for AA non-text contrast.

Worth reminding that for text contrast the minimum contrast ratio is 4.5:1 (with exceptions for large text) so the lightest gray that can be used is #6c7781.

@chrisvanpatten
Copy link
Contributor

From a design perspective my only question is whether the border-radius should match for buttons and inputs, but overall the new design looks great. The darker border is actually kinda nice! 👍

@jasmussen
Copy link
Contributor Author

Good catch Andrea, I'll revise the comment and add the other note as well.

From a design perspective my only question is whether the border-radius should match for buttons and inputs

This is a good catch. I'll noodle on this — the radius is the same as it is for the new buttons, but not for the old buttons. I'll see if I can unify all three somehow, or at least reduce to two.

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.

I really like this and think it would be a benefit as is to get in. We can iterate from there. Thanks for working on this.

@tofumatt tofumatt removed the Needs Design Feedback Needs general design feedback. label Aug 2, 2018
Copy link
Member

@tofumatt tofumatt left a comment

Choose a reason for hiding this comment

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

Looks great. There are a few little tweaks worth making before merge. Just a few commented-out lines that should be removed and a few cleanup requests if you can make them.

After that, please do 🚢

@@ -166,15 +166,22 @@

// Tabs, Inputs, Square buttons
@mixin input-style__neutral() {
outline-offset: -1px;
//outline-offset: -1px;
Copy link
Member

Choose a reason for hiding this comment

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

🔥

}

@mixin input-style__focus() {
color: $dark-gray-900;
outline: 1px solid $blue-medium-600;
box-shadow: 0 0 0 2px $blue-medium-200;
//outline: 1px solid $blue-medium-600;
Copy link
Member

Choose a reason for hiding this comment

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

🔥

border-color: $blue-medium-500;
box-shadow: 0 0 0 1px $blue-medium-500;

// Windows High Contrast mode will show this outline, but not the box-shadow
Copy link
Member

Choose a reason for hiding this comment

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

Comments should end with a period.

@@ -57,5 +57,5 @@ $block-parent-side-ui-clearance: $parent-block-padding - $block-padding; // spac
$block-container-side-padding: $block-side-ui-width + $block-padding + 2 * $block-side-ui-clearance;

// Buttons & UI Widgets
$button-style__radius-roundrect: 4px;
$button-style__radius-round: 50%;
$radius-roundrect: 4px;
Copy link
Member

Choose a reason for hiding this comment

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

I know it was like that when you got here, but since we're changing it anyway, could we make this $radius-round-rectangle? roundrect is quite unfriendly.

border-bottom: none;
background-clip: padding-box;

// put toolbar snugly to edge on mobile
margin-left: -$block-padding - 1px; // stack borders
margin-right: -$block-padding - 1px;
margin-left: -$block-padding - $border-width; // stack borders
Copy link
Member

Choose a reason for hiding this comment

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

That's a weird indentation and doesn't really quite explain this, but I think it's saying "This stacks the border on top of another border"?

I dunno, leave it if it's not clear, but since this line is already changing it'd be nice to tidy it up. 🤷‍♂️

@jasmussen jasmussen force-pushed the polish/focus-active-styles branch from 2f61bb5 to 71ef5d4 Compare August 3, 2018 06:36
@jasmussen
Copy link
Contributor Author

Thanks for the reviews. Addressed feedback in 2f61bb5. Rebased and hoping the tests pass.

Noting though, that this input field change also affects checkboxes:

category

But I don't think that's a problem, quite the opposite actually.

@tofumatt
Copy link
Member

tofumatt commented Aug 3, 2018

Last night tests were failing a bunch (as were local installs using bin/install-wordpress.sh) because of a weird Docker permission thing. If CI is still failing on Installing WordPress... that's the same error... I guess we'll have to fix it up, but I have no idea what caused it... 😢

@jasmussen
Copy link
Contributor Author

Also through in a micro fix for a double border:

screen shot 2018-08-03 at 08 46 50

Now:

screen shot 2018-08-03 at 08 46 37

@jasmussen
Copy link
Contributor Author

screen shot 2018-08-03 at 08 50 19

Tests pass locally, though I'm on an old version of the dev environment where I can't run the e2e tests locally (I know, I'll get to it). Would appreciate if someone can verify whether Travis is making mistakes or whether a legit test is failing.

@tofumatt
Copy link
Member

tofumatt commented Aug 3, 2018

It's legit, sort of: #8418.

I'll see why the Docker container is messed up, but I'm not really sure why that's happening.

@jasmussen jasmussen added this to the 3.5 milestone Aug 3, 2018
Joen Asmussen added 3 commits August 6, 2018 09:21
@jasmussen jasmussen force-pushed the polish/focus-active-styles branch from 9aaa0bc to 5e9ef96 Compare August 6, 2018 07:22
@jasmussen
Copy link
Contributor Author

Rebased, squashed. Noting this causes a re-test. Hoping the tests pass now.

@jasmussen
Copy link
Contributor Author

Merging as tests pass and this is approved, yay!

@jasmussen jasmussen merged commit b83b827 into master Aug 6, 2018
@jasmussen jasmussen deleted the polish/focus-active-styles branch August 6, 2018 07:36
@ktmn
Copy link

ktmn commented Aug 11, 2018

Any particular reason for the 4px border radius? Everything else is 0px except buttons, I kind of preferred it that way.
For example when a select is surrounded by text the lack of border radius sort of makes it look more like a singular unit (although that's very subjective).

Side note: the dropdown arrow doesn't have the best spacing either and seems distorted (browser specific?).

I mean, maybe there's a case for it here:

so the inputs look similar to buttons, but they don't look worse without border radius either.

Also input[type=text] is has 31px height while select has 28px

@jasmussen
Copy link
Contributor Author

@ktmn I agree the select box could use some love.

The answer is that yes, there's a reason. The reason is that it's so far the best input field design we've found that:

  • Has sufficient contrast against a white background
  • Looks like an input field, even when showing in otherwise square gray-bordered boxes

Gutenberg introduces a number of new design elements, and notably a number of accessibility improvements compared to WordPress core. We've tried a few other designs for input boxes that met these requirements, but so far the rounded version was the only one that passed the test for meeting all the requirements and notably feeling right in Gutenberg.

We could try reducing the border radius to 3px, perhaps. This is the same radius that stock buttons use.

@2one2
Copy link

2one2 commented Aug 22, 2018

I agree with @ktmn, having border radius on select, input, textarea fields just doesn't feel right.

And there are other issues, inconsistencies:

  • select dropdown doesn't have border radius and can't be styled
  • featured image button doesn't have border radius
  • textarea ( post excerpt ) looks smaller in an already narrow space
  • button was more distinct than other fields

@karmatosed
Copy link
Member

A border radius even is small does have a softening effect I think is a positive impact visually. I am ok experimenting reducing, however I think overall it's a positive step.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Some input boundaries lack sufficient contrast
7 participants