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

Fix edgecases for Windows high contrast mode #5526

Merged
merged 2 commits into from
Mar 9, 2018

Conversation

jasmussen
Copy link
Contributor

Fixes #5244.

This PR makes two changes to how focus and active state styles are rendered, so as to accommodate Windows high contrast mode.

The first is to the Settings button which did not have a focus style, it does now:

settings

The second is for tabs, both the Document & Block tabs, but also the Inserter tabs:

high contrast

They look unchanged in normal mode:

normal

#5138 also suggests a change to the Publish and Preview buttons, because these do not have a focus style in high contrast mode. I tried to address this, but decided this should be fixed upstream in WordPress, due to this rule that is inherited:

.wp-core-ui .button:active, .wp-core-ui .button:focus {
    outline: 0;
}

While we can override this, it would create technical debt and still benefit only the editor. As such, I would suggest instead that this is addressed as part of https://core.trac.wordpress.org/ticket/41286. Here's a psuedo patch:

.wp-core-ui .button:active, .wp-core-ui .button:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
}

This would result in the following:

screen shot 2018-03-09 at 10 43 07

Joen Asmussen added 2 commits March 9, 2018 10:39
Also change `::before` to `:before` because that's what's done most consistently. Small bundle fix ¯\_(ツ)_/¯
@jasmussen jasmussen self-assigned this Mar 9, 2018
@jasmussen jasmussen requested a review from afercia March 9, 2018 10:07
@jasmussen jasmussen added the [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). label Mar 9, 2018
Copy link
Contributor

@afercia afercia left a comment

Choose a reason for hiding this comment

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

Tested. Awesome, thanks! 👍

Note 1: IE11 doesn't support outline-offset but that's really not important, it just means the outline will be a bit bigger:

screenshot 51

screenshot 52

Note 2: the partially missing top border of the Publish button in Edge is caused by display: inline-flex; in combination with the line-height (no idea why). I may be wrong but seems to me this property is not necessary.

@jasmussen
Copy link
Contributor Author

Thanks for testing!

Note 1: IE11 doesn't support outline-offset but that's really not important, it just means the outline will be a bit bigger:

Ah, yeah it's still definitely visible, and if it happens to stack it should invert the colors below it. 👍 👍

Note 2: the partially missing top border of the Publish button in Edge is caused by display: inline-flex; in combination with the line-height (no idea why). I may be wrong but seems to me this property is not necessary.

Indeed. I think the partially missing top border is actually the contents of the button getting a black background by Windows, and due to the lineheight that inner content overlaps the button border. What's weird that it's an issue with Publish... and not Preview, and they both use lineheights to center the text in the larger buttons.

I doubt it's the last time I visit high contrast mode, and I doubt it's the last time we revisit the Button component, so let's keep this in mind as we enhance those.

@jasmussen jasmussen merged commit c2710e3 into master Mar 9, 2018
@jasmussen jasmussen deleted the fix/high-contrast-edgecases branch March 9, 2018 11:15
jasmussen pushed a commit that referenced this pull request Mar 9, 2018
This fixes a regression I introduced in #5526. If you have a color scheme enabled that isn't the standard one, everything would look fine, but the default color scheme lacked the bottom border indicator for tabs in the inserter. This fixes it.
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).
2 participants