pursue better contrast on outlines for menus, dialogs, etc. especially in dark mode #12957
Replies: 10 comments 1 reply
-
One interesting thing I noticed was that in the Overflow menu on the usage page, the focus indicator is used to create that clear boundary. |
Beta Was this translation helpful? Give feedback.
-
@mbgower That outline is what actually happens on all our dropdowns. I think a lot of our illustrated dropdowns in website images aren't showing the focus border but it does always appear in code for dropdowns. The focus stays on the whole menu then the hover style is what appears when arrowing through the options. It gets to be a lot of you have a focus outline around the menu and also a focus outline around the items. https://react.carbondesignsystem.com/?path=/story/components-dropdown--default |
Beta Was this translation helpful? Give feedback.
-
I think this can be a good approach where the component takes some kind of outline focus around the whole. Please note that the hover style shading when arrowing through the options needs to meet 3:1 against the non-focused items! However, this approach doesn't address the problem for something like a dialog (where the focus would normally only be on the elements within it that take focus). So I think the request to improve contrast on outlines in such situations still exists? |
Beta Was this translation helpful? Give feedback.
-
This might need to turn into a Github Discussion rather than an issue that needs to be addressed. |
Beta Was this translation helpful? Give feedback.
-
I also believe that some of the work @thyhmdo has done on Tiles may be appropriate to consider here. |
Beta Was this translation helpful? Give feedback.
-
Hey Michael, there are couple thoughts.
|
Beta Was this translation helpful? Give feedback.
-
thanks, Thy. I think the outline around that Dallas menu/dropdown is working okay. They've basically stuck with the black of the top nav bar for the options list background, and then used grey 80 both for the item with focus and as the stroke on the outline. Ironically it is not very high contrast either. If they used a gray 70 that could almost get to 3:1 while letting the the Gray 10 text still contrast more than 4.5:1 when the item is selected (Dallas). It's actually going to be hard to indicate the option with focus using just a fill because it's tough to get a color that both contrasts 3:1 against the fill of unselected options and also 4.5:1 between the fill and the text colour. A safer option is to put a focus indicator around the menu/list as well as the item. It wouldn't even need to be as thick as the one around Manage in the bottom example, but a 1 pixel around the whole list would certainly pump it up and ensure that when the focus appearance comes into force with WCAG 2.2, this would pass. (As it is, it will fail the contrast on the option with focus.) So I guess there are two different topics we should be careful not to mix up too much:
|
Beta Was this translation helpful? Give feedback.
-
Another instance from the zAIOps team (Example provided by Phoebe Cai) where dropdown menus overlay dashboard content using similar colors. I do know currently that the menu would technically get a focus outline here, but we have had recent discussions on if we need to change it. |
Beta Was this translation helpful? Give feedback.
-
Thanks, @laurenmrice. I will note that WCAG 2.2's Focus Appearance has been moved to a AAA. It's not that people did not want to have a requirement for enough contrast for the item with the focus, but we could not find a way of consistently testing it that did not get very tricky on variable backgrounds. |
Beta Was this translation helpful? Give feedback.
-
Especially in dark mode, the outlines of tooltips, menus, dialogs and other types of overlays can be under-pronounced.
In the below screenshot of a dialog, the low constrast between the gray box and the darker gray background results in an experience where things like the X close buttons seems to be floating in the middle of the page.
Although 'white space' can be used to separate the text of such non-persistent content from the background a demarcation of the border that achieves 3:1 would reduce potential failures of Non-text Contrast.
Note that this is more likely in the realm of 'ehancement' than 'bug' -- I don't think in most cases we'd fail Non-text Contrast, because one can argue that you don't need the border to identify the component. But the benefit of more contrast is clear and backed up by our research. This is especially useful for low vision users, who may have more difficulty locating this material when it appears, as well as more difficulty differentiating between this material and content behind it.
Beta Was this translation helpful? Give feedback.
All reactions