Skip to content

Button active and focus state needs more distinct styling #127

Closed

Description

@ellatrix

Why? Accessibility. Some people don't see well. 👓

The contrast difference between active state and normal state is not big enough. Ideally it needs something like a border, inverted colours, underline...

http://webaim.org/resources/contrastchecker/

This is the style in core:

screenshot 2017-02-21 19 02 07

Activity

  1. mapk commented on Feb 23, 2017

    @mapk
    Contributor

    Current view of hover state:
    current-hover-state

    Proposed revision:
    I know there was discussion about the UI being heavy, so I tried to keep this as light as possible. I'm basing it all from the sketch file.

    The contrast on the active states is compliant for WCAG 2 AA (18pt+). Does that work in relation to our icons there?
    hover-state

  2. ellatrix commented on Feb 23, 2017

    @ellatrix
    MemberAuthor
  3. ellatrix commented on Feb 23, 2017

    @ellatrix
    MemberAuthor

    screenshot 2017-02-23 19 59 19

  4. ellatrix commented on Feb 23, 2017

    @ellatrix
    MemberAuthor

    Maybe contrast between two backgrounds is allowed to we smaller though, worth checking.

  5. afercia commented on Feb 23, 2017

    @afercia
    Contributor

    Contrast ratio can be just 3:1 instead of the usual 4.5:1 for "Large-scale" text, which is text "with at least 18 point or 14 point bold or font size". I'm not sure how to apply this to svg icons :) THey look bold to me, not sure about the font-size.

    Adding a shape, even a subtle one, can surely help.

    Just as a reminder: controls need also a focus style.

  6. ellatrix commented on Feb 23, 2017

    @ellatrix
    MemberAuthor

    The contrast between the white background and the grey background is 1.27:1.

  7. afercia commented on Feb 23, 2017

    @afercia
    Contributor

    Ah well that. The difference between the two states should be perceivable. That reminds me of https://core.trac.wordpress.org/ticket/28599 where our recommendation is to use an additional indicator, like a shape.

  8. afercia commented on Feb 23, 2017

    @afercia
    Contributor

    Reference about font-size for contrast ratio:
    https://www.w3.org/TR/WCAG20-TECHS/G18.html

    The ratio between sizes in points and CSS pixels is 1pt = 1.333px, therefore 14pt and 18pt are equivalent to approximately 18.5px and 24px.

    Still not clear how to apply that to svg icons 😬

  9. added
    [Focus] Accessibility (a11y)Changes that impact accessibility and need corresponding review (e.g. markup changes).
    on Feb 23, 2017
  10. mapk commented on Feb 23, 2017

    @mapk
    Contributor

    I believe the svg icons are 24px, so we should be ok. But the lighter grey against the white non-active state is still an issue.

  11. afercia commented on Feb 23, 2017

    @afercia
    Contributor

    Well, the icons rect is 24px. The glyphs inside the rect are smaller :) But as long as they're bold and they don't go under a corresponding font-size of 18.5px they should be ok.

  12. ellatrix commented on Feb 23, 2017

    @ellatrix
    MemberAuthor

    The issue is not really the contrast between the icons and the background. That is 👌. The issue's the difference between the normal and active state, the white and light grey background. Which may be enough, I'm not entirely sure about that.

    The difference between the two states should be perceivable. That reminds me of https://core.trac.wordpress.org/ticket/28599 where our recommendation is to use an additional indicator, like a shape.

    So it sound like an extra indicator is good, but it hard to know what contrast between backgrounds is actually enough.

  13. jasmussen commented on Feb 24, 2017

    @jasmussen
    Contributor

    Good explorations so far. Keep the thoughts coming.

    Let's expand our minds, as Ella suggests, and think beyond just color as something that can add contrast. Some other ideas:

    formatting click

    formatting click 2

    formatting click 3

    formatting -click-4

    Neither of 👆 feel juuust right to me, but we're making progress here. @mapk importantly noted that the blocks were mentioned as feeling heavy, and as soon as we lightened the block borders and used the light white floaty chrome everywhere, the critique subsided. This is important to keep in mind, so we don't regress here.

    We have to find a balance between the light UI and proper accessability, and we are on the cusp of it. Keep thinking folks! 🌟 work so far.

  14. jasmussen commented on Feb 24, 2017

    @jasmussen
    Contributor

    Also — this is a UI that has been solved in the past. Let's look at what others have been doing, like Google Docs, Word, Pages, Keynote, any other app or web-app that uses formatting controls like this.

  15. 30 remaining items

  16. anna-harrison commented on Mar 8, 2017

    @anna-harrison

    Great discussion with some really interesting insights, which I think distill down to three (+1) key points:

    1. Accessibility should be designed into the product from the start, not added in later
    2. It's quite challenging to meet accessibility requirements using colour alone - especially in the context of wanting a "light and modern" aesthetic
    3. If colour alone is not enough, we need to use something else - like shape
    4. [optional bonus] The interaction is a little fun :)

    So today we had a crack at playing around with something that meets the above criteria: you can interact with it here http://codepen.io/napy84/pen/LWbBrv

    animatedbuttons

    It's possibly too much/not the right kind of animation ( discussion on animation style guide here #15 ) to be used on every button, but perhaps if used selectively, like on the block level controls, could be both elegant and provide differentiation from the [selection]-toolbars

  17. jasmussen commented on Mar 8, 2017

    @jasmussen
    Contributor

    Thank you for your endless patience here, @afercia. This is important to get right. It sounds like the following would pass:

    type switcher

    But by those rules put out alone it sounds like Google Docs, Office 365, Apple Pages, Sketch would all fail:

    office365

    docs

    sketch

    apple pages

    That last one is Apple Pages, which achieves a 2.6:1 contrast ratio, the most of them all. But it's still not 3:1.

    Can you confirm that all those above fail the accessibility bar, or do they pass through other means? If so, what makes them pass? You mention:

    unless we're going to use some additional indicator to distinguish the different states

    To me this sounds like a border, or an inset shadow on the active item. But in all of those above, the border itself does not have enough contrast either. Is it the very dark border around the active item in current TinyMCE that makes the current iteration of the editor pass?

    screen shot 2017-03-08 at 09 30 27

    I am very grateful for your time here.

  18. ellatrix commented on Mar 8, 2017

    @ellatrix
    MemberAuthor

    Is it the very dark border around the active item in current TinyMCE that makes the current iteration of the editor pass?

    Yes, it is. :) Here's the most recent commit for that: WordPress/wordpress-develop@e9f1903

    Would be good to know which others pass or not. It sounds like inverse colours make it so that appearance is distinct enough from the other buttons.

    Even if the others do not pass, it doesn't mean our editor shouldn't, and this is a great area where the WordPress editor can shine, together with all the other improvements we're doing. Like @afercia mentioned, it's a really interesting design challenge, where alternative creative solutions are welcome. Maybe there's a whole new way to design active states. :)

  19. jasmussen commented on Mar 8, 2017

    @jasmussen
    Contributor

    Even if the others do not pass, it doesn't mean our editor shouldn't

    Absolutely, did not mean to imply otherwise. 😉

  20. Afraithe commented on Mar 8, 2017

    @Afraithe

    Googles Material Design could also be a source of inspiration around this I guess.

    https://material.io/guidelines/components/buttons.html

  21. jasmussen commented on Mar 8, 2017

    @jasmussen
    Contributor

    How's this?

    type switcher

    That's a 4.8:1 on the contrasts, as far as I can tell.

  22. mapk commented on Mar 8, 2017

    @mapk
    Contributor

    According to @afercia:

    Enter the two colors and the ratio is 1.26:1. Instead, it must be at least 3:1, unless we're going to use some additional indicator to distinguish the different states.

    So that means this ones fails:

    374c85e2-03e1-11e7-807c-a8d01306e478
    Luminosity Contrast is 1.46:1

    The gradient in this one might be a bit more tricky?
    3faeb52a-03e1-11e7-969a-3a4064f9e8a1

    Lighter top Lum Contrast is 2.15:1
    Darker bottom Lum Contrast is 3.1:1
    But it's also inverting the color, which is more than just changing the background.

    I do like this one below the best. But we still need a HOVER state designed.
    f77d423a-03e0-11e7-8ae0-56bc5f59571c

    Maybe something like this?
    screen shot 2017-03-08 at 7 42 29 am

  23. afercia commented on Mar 8, 2017

    @afercia
    Contributor

    I think the one with the subtle dark border, the last one posted by @jasmussen would pass 🙂 Also the last one by @mapk 🙂

    by those rules put out alone it sounds like Google Docs, Office 365, Apple Pages, Sketch would all fail

    I'm really not sure what are their accessibility requirements 🙂

    it's a really interesting design challenge, where alternative creative solutions are welcome. Maybe there's a whole new way to design active states. :)

    Yay! +1

  24. TheSpyder commented on Mar 8, 2017

    @TheSpyder

    There's a tool to help you know if it passes - a Firefox addon called ainspector. It will likely complain about a lot more than contrast, but if you're diving into accessibility that's a good tool to use in general. It's very picky but so are the standards 😉

    The last one by @mapk is what we do in textbox.io which definitely passes.

  25. jasmussen commented on Mar 29, 2017

    @jasmussen
    Contributor

    Closing as this is solved by the inverted version in the mockups: https://wpcoredesign.mystagingwebsite.com/gutenberg/

    Feel free to reopen if this issue surfaces again.

  26. added a commit that references this issue on May 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Focus] Accessibility (a11y)Changes that impact accessibility and need corresponding review (e.g. markup changes).

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions