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

Improve button focus styles #15432

Closed
melchoyce opened this issue May 4, 2019 · 11 comments · Fixed by #15544
Closed

Improve button focus styles #15432

melchoyce opened this issue May 4, 2019 · 11 comments · Fixed by #15544
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). General Interface Parts of the UI which don't fall neatly under other labels. Needs Dev Ready for, and needs developer efforts

Comments

@melchoyce
Copy link
Contributor

Input fields have a medium blue border that replaces the grey input border:

image

But buttons have light blue border outside of the button borders:

image

This is inconsistent, and the button focus styles need to have a minimum contrast ration of 3.1.

Prior idea from @jasmussen:

image

Some additional ideas:

image

The bottom color is #008EC2, which has a contrast ratio of 3.72. (We'll want to update the input focus styles to also be this color, but we can do that in a separate issue.) This is my preferred option of these three.

Related: #15325, #13900, and https://core.trac.wordpress.org/ticket/34904.

@melchoyce melchoyce added the General Interface Parts of the UI which don't fall neatly under other labels. label May 4, 2019
@melchoyce melchoyce added Needs Accessibility Feedback Need input from accessibility Needs Design Feedback Needs general design feedback. labels May 5, 2019
@afercia
Copy link
Contributor

afercia commented May 5, 2019

+1
See also #13267 for a bug that affects Firefox.

@afercia afercia added [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). and removed Needs Accessibility Feedback Need input from accessibility labels May 5, 2019
@jasmussen
Copy link
Contributor

Thanks for taking a stab, Mel. Of your designs, these seem the most promising to me:

Screenshot 2019-05-06 at 09 47 02

One thing I think is worth bringing up: those designs assume we can't redesign the buttons themselves. I'm not saying we absolutely have to do that, but rather opening that up as a "what if". What would buttons look like, redesigned from scratch, to be more legible, accessible, consistent?

Based on the existing tickets around this, I've dabbled with this for a while, and here's the most recent iteration:

Screenshot 2019-05-06 at 09 47 49

One aspect I'd like to highlight with the above, is that this style affords us better contrast around the secondary button with the 1px border, where the old button relies on a drop shadow (which is removed in high contrast mode). Additionally, by leveraging that border to change the thickness on focus, we can keep the clear focus style change (contrast & shape), but without complicating the silhuette (double-borders). The double border is okay and necessary for the primary button given the similarity in colors, but given the primary button is a solid, the silhuette remains simple. Finally, changing the button border on focus gives a nice consistency callback to input fields:

Screenshot 2019-05-06 at 09 51 13

@afercia
Copy link
Contributor

afercia commented May 6, 2019

Relevant core Trac tickets:

The design of the focus outline on buttons/elements could be improved
https://core.trac.wordpress.org/ticket/34904
With some design proposals from @MichaelArestad

a11y-focus: Standardizing the handling of :focus and :hover
https://core.trac.wordpress.org/ticket/34957

@truchot
Copy link
Contributor

truchot commented May 7, 2019

I ask a silly question: why some buttons have 1px spacing when focusing, but not all ? (like on secondary version or icons buttons)

@afercia
Copy link
Contributor

afercia commented May 8, 2019

Noting that this issue should cover also other similar cases reported in other issues, now closed in favor of this one. For example. the Calendar selected date, prev/next month buttons, some custom elements in the sidebar, etc.

See for example screenshot from the full WPCampus report (issue #15277:

Screenshot 2019-05-08 at 17 15 21

@afercia
Copy link
Contributor

afercia commented May 8, 2019

@truchot I guess because without the 1 pixel spacing, the focus outline would just make the button bigger. The spacing allows to clearly see the additional shape on focus:

Screenshot 2019-05-08 at 17 18 48

@melchoyce
Copy link
Contributor Author

I guess because without the 1 pixel spacing, the focus outline would just make the button bigger. The spacing allows to clearly see the additional shape on focus:

Yup! That's exactly it. It distinguishes the outline from the button.

@melchoyce melchoyce added Needs Dev Ready for, and needs developer efforts and removed Needs Design Feedback Needs general design feedback. labels May 8, 2019
@melchoyce
Copy link
Contributor Author

melchoyce commented May 8, 2019

Based on the existing tickets around this, I've dabbled with this for a while, and here's the most recent iteration...

Let's get a PR up for this. Marking as needs-dev.

@jasmussen Do you want to try this pattern out on the select menus?

@truchot
Copy link
Contributor

truchot commented May 9, 2019

I guess because without the 1 pixel spacing, the focus outline would just make the button bigger. The spacing allows to clearly see the additional shape on focus:

Yup! That's exactly it. It distinguishes the outline from the button.

I visually prefer the 1px spacing that's the reason of my question, why not all ?
:)

@melchoyce
Copy link
Contributor Author

Didn't feel necessary for the lighter buttons, but we could certainly try it out.

@truchot
Copy link
Contributor

truchot commented May 9, 2019

Should the button style be flattened or we keep the shadow style ?

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). General Interface Parts of the UI which don't fall neatly under other labels. Needs Dev Ready for, and needs developer efforts
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants