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

Command Palette: highlighted suggestions insufficient contrast #51582

Closed
afercia opened this issue Jun 16, 2023 · 21 comments · Fixed by #54318
Closed

Command Palette: highlighted suggestions insufficient contrast #51582

afercia opened this issue Jun 16, 2023 · 21 comments · Fixed by #54318
Assignees
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). Needs Design Feedback Needs general design feedback. Needs Design Needs design efforts. [Package] Commands /packages/commands [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@afercia
Copy link
Contributor

afercia commented Jun 16, 2023

Description

In the Command centre, users can 'highlight' suggestions by using the Down and Up arrow keys, or by hovering on them.

Worth noting this is not a real 'focus' style. Actually, focus is on the search input. The suggestions are highlighted and 'selected' via scripting. Nevertheless, since it is possible to select and activate the suggestions, users need to have a clear indication of what the highlighted / selected suggestion is.

The highlighted state style only relies on a subtle color change. Color only is not sufficient. Teh highlighted style needs a shape, whether it's an outline or a left border like in the classic admin menu.

Aside: I think this 'highlighted' style is used also elsewhere. It should be fixed wherever it is used.

Screenshot: hint: the fourth suggestion is the highlighted one.

Screenshot 2023-06-13 at 15 23 57

Step-by-step reproduction instructions

  • Go to teh Site editor.
  • Open the Command centre.
  • Enter a search term e.g.: 'template'.
  • Wait for the list of suggestions to be displayed.
  • Use the Down and Up arrow keys to navigate the suggestions.
  • Also try hovering the suggestions.
  • Observe the highlighted style only uses a color change.

Screenshots, screen recording, code snippet

No response

Environment info

No response

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@afercia afercia added [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Package] Commands /packages/commands labels Jun 16, 2023
@jameskoster jameskoster added the Needs Design Needs design efforts. label Jun 19, 2023
@jameskoster
Copy link
Contributor

Previous mockups for suggestions have included a classifying label, e.g. "Command", "Shortcut", etc:

Screenshot 2023-06-19 at 13 34 48

If such as label was iconised and exposed on hover, would that qualify as a shape change?

Screenshot 2023-06-19 at 13 40 31

@jasmussen
Copy link
Contributor

I suggested a "Run command" text a la GitHub on the PR, but I like the arrow better. I wonder if it should be a chevron? It could also be a little [Run] chip design. But yes, it qualifies as a shape change.

@jameskoster
Copy link
Contributor

At the moment we have the following 'types' of actions:

  • Shortcut – E.g. go directly to the Styles panel
  • Command – E.g. Delete a template, Add a page

It might get a little fuzzy if we have different icons for each? So I would be tempted to stick to a single icon to begin with, if we go down that route and revisit if/when more action types are added. I chose the Arrow instead of the Chevron since we use chevrons to indicate drilldowns elsewhere, but maybe that doesn't matter? Or maybe there's another icon to try.

Text labels would probably be clearer: [Run] for commands, [Jump to] (or similar) for shortcuts.

Screenshot 2023-06-20 at 10 46 24

That would enable us to remove the 'Open...' prefixes too which are a little ambiguous imo. For that reason I'm starting to lean more towards the text labels 😅

@jasmussen
Copy link
Contributor

Single icon sounds like a good start and is easy to implement, and doesn't preclude revisits in the future.

@jameskoster
Copy link
Contributor

Yep, that's a good point. Alternatives to the arrow:

Return

Screenshot 2023-06-20 at 11 23 21

Could be a hint for keyboard interaction?

Chevron

Screenshot 2023-06-20 at 11 25 01

I worry this suggests a drilldown which isn't what happens. Not a stong feeling, but maybe we should reserve this in case drilldowns are added to the command palette down the road?

@jasmussen
Copy link
Contributor

Good point on the chevron. I don't personally share the full concern, though I would think the regular arrow works better than the return.

@afercia
Copy link
Contributor Author

afercia commented Jun 21, 2023

While the arrow could work, I'd rather suggest to look at the big picture and try to standardize this 'highlighted option' style across the UI. As far as I can tell there are at least two components that show a list of options:

  • Combobox (search + suggested options)
  • CustomSelectControl

where the highlighted style is largely inconsistent. A few examples:

Slash inserter:

slash inserter

Link suggestions:

link suggestions

Tag suggestions:

tags suggestions

Position settings:

position

Comment date format:

comment date format

Font appearance:

font appearance

@jameskoster
Copy link
Contributor

Since (as pointed out in the OP) this isn't a true focus, wouldn't it be a little contradictory to use the outline treatment?

Perhaps it would help to better define 'shape change' for this context? IE why is adding a background color not a shape change? Isn't it the addition of a shape where none was previously visible? Would it be different if the background had stronger contrast, IE:

Screenshot 2023-06-21 at 11 05 24

To be clear I'm not proposing we do that, just trying to better understand the problem. Thanks.

@richtabor
Copy link
Member

I worry this suggests a drilldown which isn't what happens.

We may have drilldown commands one day too.

@annezazu annezazu added the [Type] Bug An existing feature does not function as intended label Jul 3, 2023
@afercia afercia added the Needs Design Feedback Needs general design feedback. label Aug 22, 2023
@afercia
Copy link
Contributor Author

afercia commented Aug 22, 2023

After two months this issue has been created this still needs a design decision. In the meantime, the command center has been realeased in WordPress 6.3. It's unfortunate that a such prominent feature gets released with an insufficient accessibility (and usability) level. Honestly, I'm not sure this way of releasing software is ideal for a project that aims to match a high quality level.

That said, this only needs a design decision. The implementation part is just CSS. The challenge here is mostly about making all the autocomplete comboboxes look the same across the editor. As of now, there's still large inconsistency across all the autocompleters and I'm no sure this is ideal for users and for the reputation of WordPress.

Couple screenshots from current trunk:

Command center: the highlighted suggestion is barely visible:

Screenshot 2023-08-22 at 09 44 14

Tags: totally different styling and also functionality, as the search term is underlined within the suggestions:

Screenshot 2023-08-22 at 09 46 40

@annezazu annezazu changed the title Command centre: highlighted suggestions insufficient contrast Command Palette: highlighted suggestions insufficient contrast Aug 24, 2023
@joedolson
Copy link
Contributor

We shouldn't need to wait on a global design decision in order to fix an extremely obvious accessibility problem. We can resolve the accessibility problem with a very simple design change to improve contrast; all of the other larger design issues can be resolved after fixing the accessibility issue.

We need to keep in mind that fixing an accessibility issue has a direct and immediate impact on users who depend on it; it resolves a major user experience problem for the people it impacts. The other design issues need to be done with accessibility in mind, but should not block us from fixing an immediate problem.

@jeryj
Copy link
Contributor

jeryj commented Sep 8, 2023

To close this issue, we only need a decision on the colors to use to highlight the suggestion. Those colors need to have sufficient contrast. The other design decisions on icons and consistency across the editor can be a follow-up.

@richtabor
Copy link
Member

richtabor commented Sep 8, 2023

Since (as pointed out in the OP) this isn't a true focus, wouldn't it be a little contradictory to use the outline treatment?

This unanswered question is what's holding up.

We shouldn't need to wait on a global design decision in order to fix an extremely obvious accessibility problem.

We should always push for consistency, rather than ad-hoc fixes (which results in varying experience like expressed in this comment above  — but I do agree we need to resolve this.

That saying, here's what we have today:

current

And below are the options:

2 1 4 5 CleanShot 2023-09-08 at 15 24 51

Request

The options above are based on other variants of existing flows within the editor.

Do you mind detailing what won't work (and why), as well as what will work (and why). That would help clear the air and move this forward (as well as consolidating the other suggestion + selection flows).

I would like to come to a solution that we can apply consistently everywhere, so in the future when something like this comes up there is a clear standard. cc @WordPress/gutenberg-design

@joedolson
Copy link
Contributor

Any of the combinations that meet basic accessibility standards for color contrast will work. Beyond that, I have no concern about which design is used. Not knowing which colors are represented above, I can't say with certainty which of those meet standards.

@jeryj
Copy link
Contributor

jeryj commented Sep 8, 2023

Since (as pointed out in the OP) this isn't a true focus, wouldn't it be a little contradictory to use the outline treatment?
This unanswered question is what's holding up.

I don't think there's a standard around this, and it's more about consistency and color contrast than which specific style is chosen. That said, since the outline focus is used on the inputs and sometimes wrapper depending on context, that having a solid color background to show selection will be the best choice. Whichever solid color background that meets the color contrast guidelines (4.5:1 for AA standard) sounds good to me.

The purple one is appealing, as it has strong contrast with both the text inside the color and against the white background. It also feels a bit more modern and bold to me. The light gray background makes it harder to see which one is selected since there's not much contrast between the light gray and white background.

@richtabor
Copy link
Member

richtabor commented Sep 8, 2023

@joedolson I'm trying to work with you and move this forward. I personally have concern for accessibility and design—we do need both.

Not knowing which colors are represented above, I can't say with certainty which of those meet standards.

All options are placed on a #FFFFFF canvas:

Option one:

  • Background #FFFFFF
  • Foreground #3858E9 (based on current admin color scheme)

Option two:

  • Background #3858E9 (based on current admin color scheme)
  • Foreground #FFFFFF

Option three:

  • Background #F0F0F0
  • Foreground #1E1E1E

Option four:

  • Background #E0E0E0
  • Foreground #1E1E1E

Option five:

  • Background #FFFFFF
  • Foreground #3858E9 (based on current admin color scheme)
  • Outline #3858E9 (based on current admin color scheme)

@jeryj
Copy link
Contributor

jeryj commented Sep 8, 2023

Did some Googling to confirm. I could be wrong, but I believe that to meet AA guidelines the color combinations need to pass two checks:

  • The color of the text on the selected item background needs to be 4.5:1 or higher
  • The background color of the selected item and the background color of the command palette need to be 3:1 or higher.

Out of those options, only option 2 meets those guidelines. The others don't meet the 3:1 contrast guideline between the selection background and command palette background.

@joedolson
Copy link
Contributor

@richtabor I don't have any personal preference about the design choices. I favor the inverted contrast (2) and the outline option (5), because they offer a higher degree of visual affordance of the selection. I apologize for being curt in my previous response.

@jeryj's description is accurate, as far as contrast is concerned. When color is the only distinguishing factor, both contrast requirements need to be met: the first describes the ability to see the text against it's background (readability) and the second describes the ability to distinguish which item is selected.

However, because there's an icon present that also indicates which item is selected, the second color distinction isn't necessary - that color contrast distinction is only required if color is the only differentiation between selected and unselected items. What Jerry is referring to is success criterion 1.4.11: Non-text contrast.

If the selection icon was also below contrast requirements, that would be a problem.

@jeryj
Copy link
Contributor

jeryj commented Sep 8, 2023

Ah, so if there's an icon to demonstrate selection then we don't need a different background color to show selection. I think in this case though, the "Open in a new tab" icon isn't to show selection but the icon that is associated with that item. Here's an example of the command palette search results with more item types, each with their own icon. I'm guessing we wouldn't want to add another icon to the mix to show selection.

Temp search on command palette with results of varying icons

Would an outline to show selection meet AA guidelines here?
Blueberry outline, no text color change to show selection

@richtabor
Copy link
Member

I think in this case though, the "Open in a new tab" icon isn't to show selection but the icon that is associated with that item.

Correct. Icons are assigned when a command is registered.

I'm guessing we wouldn't want to add another icon to the mix to show selection.

Yea, I'd rather lean on color to indicate selection rather than more iconography.

@joedolson
Copy link
Contributor

In that case, yes - only option 2 achieves the needed goal. Based on the examples, it seemed like the icon was being used to indicate which item was active, but if that's not the case, we'll need to make sure all the color contrast baselines are met.

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). Needs Design Feedback Needs general design feedback. Needs Design Needs design efforts. [Package] Commands /packages/commands [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants