Skip to content

Simplify Button styles and remove isTertiary.#25632

Closed
ZebulanStanphill wants to merge 1 commit intotrunkfrom
fix/23890
Closed

Simplify Button styles and remove isTertiary.#25632
ZebulanStanphill wants to merge 1 commit intotrunkfrom
fix/23890

Conversation

@ZebulanStanphill
Copy link
Copy Markdown
Member

@ZebulanStanphill ZebulanStanphill commented Sep 24, 2020

Description

Fixes #23890.

This PR attempts to improve the accessibility of the Button component's styles. In general, I tried to clean up some of the messy CSS and make everything more consistent.

The accent color is now used more consistently on buttons: it is now only used for hover, focus, and primary styles. (With the exception of isLink buttons, which I haven't touched in this PR.) I always thought it was confusing how the accent color was used as the default outline color of some buttons, but the hover outline color of others.

I've deprecated isTertiary and turned it into an alias of isSecondary (similar to what happened to isDefault). I couldn't find any rhyme or reason as to when one would be chosen over the other, so I figured it would make sense to just merge them.

How has this been tested?

I've checked just about every button I could find in the UI, both with "Show icon labels" on and with it off, to make sure there are no broken/missing styles.

Screenshots

Before

image
image
image
image
image
image
image
image
image
image

After

image
image
image
image
image
image
image
image
image
image

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR.

@ZebulanStanphill ZebulanStanphill added [Type] Enhancement A suggestion for improvement. [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Feature] UI Components Impacts or related to the UI component system [Type] Regression Related to a regression in the latest release [a11y] Color Contrast CSS Styling Related to editor and front end styles, CSS-specific issues. labels Sep 24, 2020
@github-actions
Copy link
Copy Markdown

Size Change: -235 B (0%)

Total Size: 1.17 MB

Filename Size Change
build/block-editor/index.js 128 kB -16 B (0%)
build/block-library/index.js 135 kB +2 B (0%)
build/components/index.js 167 kB +6 B (0%)
build/components/style-rtl.css 15.4 kB -47 B (0%)
build/components/style.css 15.4 kB -48 B (0%)
build/core-data/index.js 12 kB +1 B
build/data-controls/index.js 1.27 kB -1 B
build/data/index.js 8.43 kB -1 B
build/edit-navigation/index.js 10.4 kB -4 B (0%)
build/edit-post/index.js 306 kB -16 B (0%)
build/edit-post/style-rtl.css 6.28 kB +25 B (0%)
build/edit-post/style.css 6.26 kB +26 B (0%)
build/edit-site/style-rtl.css 3.48 kB -65 B (1%)
build/edit-site/style.css 3.48 kB -65 B (1%)
build/edit-widgets/style-rtl.css 2.79 kB -6 B (0%)
build/edit-widgets/style.css 2.79 kB -6 B (0%)
build/editor/index.js 45.4 kB -11 B (0%)
build/editor/style-rtl.css 3.83 kB -3 B (0%)
build/editor/style.css 3.82 kB -3 B (0%)
build/rich-text/index.js 13.7 kB -2 B (0%)
build/server-side-render/index.js 2.6 kB -1 B
ℹ️ View Unchanged
Filename Size Change
build/a11y/index.js 1.14 kB 0 B
build/annotations/index.js 3.52 kB 0 B
build/api-fetch/index.js 3.35 kB 0 B
build/autop/index.js 2.72 kB 0 B
build/blob/index.js 620 B 0 B
build/block-directory/index.js 8.53 kB 0 B
build/block-directory/style-rtl.css 943 B 0 B
build/block-directory/style.css 942 B 0 B
build/block-editor/style-rtl.css 11.1 kB 0 B
build/block-editor/style.css 11.1 kB 0 B
build/block-library/editor-rtl.css 8.58 kB 0 B
build/block-library/editor.css 8.58 kB 0 B
build/block-library/style-rtl.css 7.61 kB 0 B
build/block-library/style.css 7.6 kB 0 B
build/block-library/theme-rtl.css 741 B 0 B
build/block-library/theme.css 741 B 0 B
build/block-serialization-default-parser/index.js 1.78 kB 0 B
build/block-serialization-spec-parser/index.js 3.1 kB 0 B
build/blocks/index.js 47.5 kB 0 B
build/compose/index.js 9.42 kB 0 B
build/date/index.js 31.9 kB 0 B
build/deprecated/index.js 772 B 0 B
build/dom-ready/index.js 568 B 0 B
build/dom/index.js 4.42 kB 0 B
build/edit-navigation/style-rtl.css 868 B 0 B
build/edit-navigation/style.css 871 B 0 B
build/edit-site/index.js 20.5 kB 0 B
build/edit-widgets/index.js 17.5 kB 0 B
build/editor/editor-styles-rtl.css 492 B 0 B
build/editor/editor-styles.css 493 B 0 B
build/element/index.js 4.44 kB 0 B
build/escape-html/index.js 733 B 0 B
build/format-library/index.js 7.49 kB 0 B
build/format-library/style-rtl.css 547 B 0 B
build/format-library/style.css 548 B 0 B
build/hooks/index.js 1.74 kB 0 B
build/html-entities/index.js 621 B 0 B
build/i18n/index.js 3.55 kB 0 B
build/is-shallow-equal/index.js 709 B 0 B
build/keyboard-shortcuts/index.js 2.39 kB 0 B
build/keycodes/index.js 1.85 kB 0 B
build/list-reusable-blocks/index.js 3.02 kB 0 B
build/list-reusable-blocks/style-rtl.css 476 B 0 B
build/list-reusable-blocks/style.css 476 B 0 B
build/media-utils/index.js 5.12 kB 0 B
build/notices/index.js 1.69 kB 0 B
build/nux/index.js 3.27 kB 0 B
build/nux/style-rtl.css 671 B 0 B
build/nux/style.css 668 B 0 B
build/plugins/index.js 2.44 kB 0 B
build/primitives/index.js 1.34 kB 0 B
build/priority-queue/index.js 789 B 0 B
build/redux-routine/index.js 2.85 kB 0 B
build/shortcode/index.js 1.7 kB 0 B
build/token-list/index.js 1.24 kB 0 B
build/url/index.js 4.06 kB 0 B
build/viewport/index.js 1.74 kB 0 B
build/warning/index.js 1.13 kB 0 B
build/wordcount/index.js 1.17 kB 0 B

compressed-size-action

Copy link
Copy Markdown
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.

Thanks @ZebulanStanphill !
From an accessibility perspective I'd strongly recommend this change, as it fixes what the accessibility team identified as an accessibility regression in WordPress 5.5 (see the issue #23890).

In the interest of collaboration between teams and for the greater good of the project, I do realize this needs design feedback 🙂 Approving from an a11y perspective.

@joedolson
Copy link
Copy Markdown
Contributor

This looks great from my perspective, too; although I recognize that I'm basically just seconding @afercia's accessibility approval. ;)

Copy link
Copy Markdown
Contributor

@youknowriad youknowriad left a comment

Choose a reason for hiding this comment

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

Let's get this a proper design review, I'm pretty sure this is a regression in terms of the buttons importance hierarchy

@enriquesanchez
Copy link
Copy Markdown
Contributor

Thank you for working in this @ZebulanStanphill!

I understand the need to address #23890, but putting my designer hat on I have some different feedback.

At first glance, these buttons look like input fields to me. You can see how there's little to no visual difference between the proposed style for buttons and the 'Add tags' field:

Screen Shot 2020-09-28 at 11 04 20

This is also affecting the hierarchy of buttons and options. While this may not be an issue when there are just a couple of buttons, I find it very hard to parse something like this:

94205841-ba6e8000-fe89-11ea-874e-850bf1b43321

We need a balance that makes it clear these are buttons but that also not overwhelm a whole other set of users.

We're also not accounting for visual inconsistencies across the UI, like icon buttons:

Screen Shot 2020-09-28 at 11 10 44

or disabled states like the 'Redo' button over here:

94206117-4e404c00-fe8a-11ea-99ae-ffa6e16324f1


Overall I think your exploration is incredibly useful, as it allows us to find these nuanced cases that we need to be aware of when exploring a solution.

@mariohamann
Copy link
Copy Markdown

mariohamann commented Sep 28, 2020

The three button styles seem to follow Material Design: https://material.io/components/buttons#hierarchy-and-placement

I understand the PR from a11y perspective to identify every button directly as a button. However, I don't think merging the second and third level is the way to go...

Edit: @enriquesanchez was faster and has a much better answer. :)

@ZebulanStanphill
Copy link
Copy Markdown
Member Author

The points about icon button and disabled button styles are both very valid. The quick answer would be to just add borders to all of them, but in the case of icon buttons, that seems a bit too much in the top bar.

Thinking about it some more, I think there needs to be two different classes of button styles: standard and toolbar. Standard buttons would always have an outline, while toolbar buttons wouldn't, since their usage in a toolbar should be enough to make it clear that they're buttons. How does this sound?

There's a bit of a problem with the top bar, however: it's actually not a toolbar. Or at least not all of it. The left half is a toolbar, but the right half isn't.

As for buttons looking like input fields, that's another good point. But both buttons and input fields ought to have clearly defined borders. So we need to find a different way to distinguish the two via different shaping. Any ideas?

@mariohamann It's worth remembering that Material Design patterns were not designed with accessibility in mind.

The problem with using buttons that consist only of accent-colored text is that accessible designs must account for colorblind users. There needs to be distinct contrast and shaping for all variations. Again, there must be a recognizable difference in shape/contrast. Additionally, blue-text buttons look a lot like links, which they aren't.

@afercia
Copy link
Copy Markdown
Contributor

afercia commented Sep 28, 2020

It's worth remembering that Material Design patterns were not designed with accessibility in mind.

+1 to this. Keeping using Material Design as a reference in a project that aims to be accessible isn't that productive 🙂

@kellychoffman
Copy link
Copy Markdown
Contributor

Agree its not productive to compare to Material in this case, so let's just stick with the issue we are trying to solve. The buttons currently look like plain text but this particular solution will have them looking like input fields (and introduces additional a11y issues as brought up by @enriquesanchez.) Issues that I think are blockers. I think this was a solid attempt but needs to go back to the drawing board to make the UI both accessible and intuitive. (Underlines immediately comes to mind but am open to other options.)

@ZebulanStanphill
Copy link
Copy Markdown
Member Author

Agreed, this needs some more discussion. Let's continue in #23890. If anyone has any ideas, please share them there.

@ZebulanStanphill ZebulanStanphill added the [Status] Blocked Used to indicate that a current effort isn't able to move forward label Sep 29, 2020
@afercia
Copy link
Copy Markdown
Contributor

afercia commented Sep 30, 2020

We need a balance that makes it clear these are buttons but that also not overwhelm a whole other set of users.

I do understand this concern. @enriquesanchez as designer and also accessibility team member and representative, do you have any concrete proposal to find a better balance?

Base automatically changed from master to trunk March 1, 2021 15:44
@ZebulanStanphill
Copy link
Copy Markdown
Member Author

Since it's considerably out-of-date, and there's no final design solution in sight, I'm closing this PR.

I still think there's a need for a clearer and more consistent visual distinction between links, buttons, and <input>s. However, precisely what each should look like remains an open question. Until that question is answered, no progress can be made here.

I should also note that I may have gone overboard with putting outlines on every text button. I think the ones in toolbars can probably go without them, since they're known to be clickable by context, in the same way the icon buttons are known to be clickable.

Please continue discussion in #23890.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CSS Styling Related to editor and front end styles, CSS-specific issues. [Feature] UI Components Impacts or related to the UI component system [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). Needs Design Feedback Needs general design feedback. [Status] Blocked Used to indicate that a current effort isn't able to move forward [Type] Enhancement A suggestion for improvement. [Type] Regression Related to a regression in the latest release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Accessibility regression: The new buttons style prevents from identifying them as interactive user interface controls

9 participants