Problem/Motivation
From #3618906: [Meta] Forms sidebar accessibility issues
In forced-colors mode, the toggle control disappears on hover / focus.
It also has the wrong semantic color in its default state.
Testing
- Create a node.
- Edit the node. The sidebar toggle is now visible.
- Use Page Colors in Microsoft Edge, with the Night Sky theme.
- The icon should now be visible when hovered / focused, and in all states it should be yellow to match the other buttons on the page.
Proposed resolution
This should be an easy CSS fix.
| Comment | File | Size | Author |
|---|---|---|---|
| #18 | 3619155-18-edge-page-colors-night-sky.after_.png | 340.25 KB | kentr |
| #18 | 3619155-18-edge-page-colors-night-sky.before.png | 332.63 KB | kentr |
| #17 | Toggle-without-patch.mov | 4.1 MB | mgifford |
| #17 | Toggle-with-patch.mov | 1.82 MB | mgifford |
| #15 | Edit_test_test___Drush_Site-Install.png | 329.73 KB | mherchel |
Issue fork drupal-3619155
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3619155-admin-themes-toggle
changes, plain diff MR !16902
Comments
Comment #2
mherchelCrediting @kentr in issue credit due do discovery in #3618906: [Meta] Forms sidebar accessibility issues
Comment #3
kentr commentedIMO the normal-state color for the icon in forced-colors (when not hovered / focused) should also be corrected here.
Currently, the color is semantically incorrect. It should have the same color as other buttons so that it can be quickly identified as a button.
The change for this is
couldshould be in the same area of CSS that controls the hover / focus color, and it can be easily tested while testing the hover / focus states.Here's a screenshot of the node edit form in Edge page colors (Night Sky option). The toggle button is white, but should be yellow.
From a quick test in devtools, I think the fix is to use
ButtonTextfor the forced-colors background color.Comment #5
mherchelThis one's ready. Testing steps added.
Comment #6
mgifford@mherchel could you clarify on @kentr's point in #3 about the ButtonText
It makes sense to me, but I'm not sure if this is what you're agreeing with. Sometimes when issues are this close together it could well be a caching issue.
Comment #7
mherchelYep. Within forced colors link text and button text can have different colors. There are CSS system colors that map to this:
linkTextandbuttonText(see the full list at https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/system...)I used
buttonTextin the MR above, so that will map to the correct button text color that the high contrast theme has configured.Comment #8
f0ns commentedTested this issue and learned something new (the manipulation in the rendering tab of Console dev).
Before:
After:
So looks good!
Comment #9
f0ns commentedComment #10
kentr commentedIn #3, I was referring to the normal state (default state, when not hovered / focused).
Though, using
ButtonTextfor the hover / focus states is probably the right move.In my testing of the MR, the button doesn't match the others in its normal state.
@mgifford, do you agree that in the default state, the color of the button in forced-colors should match the color of other (normal) buttons in forced-colors?
I don't care if it's done here or in #3619154: Accessibility fixes for Admin theme's toggle control, but IMO it's important (edit: not minor, like the rest of #3619154: Accessibility fixes for Admin theme's toggle control). I thought it would be easier to change and test here along with the hover / focus.
Comment #11
kentr commentedThe screenshot in #3 disappeared. Uploading it again here, with an "after" screenshot using the same Edge Page Colors settings.
Before (in normal / default state, per #3):
After (in normal / default state, per #3):
Will restore the screenshot in #3.
Comment #12
kentr commentedNote:
IME, using forced-colors emulation in devtools doesn't give the full picture because some system colors don't show themselves.
The screenshots in #8 appear to corroborate that. To me, the buttons look the same color (black) as text and arbitrary borders.
You can really see this by comparing the CSS Color Module page in devtools emulation versus Edge page colors.
Comment #13
mherchelIn your images above, you're comparing a input form control to a element. You should compare a element.
Comment #14
kentr commentedPretty sure it goes by role, not by element type.
The role of that
inputshows as "button" in the accessibility tab in Edge:The
ButtonTextsystem-color is yellow on the CSS color module page:The yellow ckeditor buttons in the previous screenshot are
buttonelements.It's the same with the the Expand sidebar button, and the button element example on MDN.
Expand sidebar button:
Button element example on MDN, with all styles removed from the demo:
With the MR, the hover / focus states (which use
ButtonText) are yellow.Hover state:
When I inspect that element (the
::beforeelement) in devtools, the background color in the normal state isvar(--admin-color-icon)even in forced-colors mode. It should beButtonText.Comment #15
mherchelIt's buttonText. You're looking at something incorrectly. Happy to hop on a Zoom or whatever and share.
To test this out and be 1000% sure, I added an extra element into the DOM via Devtools
<button>This is my button</button>You can see this is also rendered as white. You can also see that its rendering with the UA styles, with the color set to buttonText.
Once again, I'm happy to hop on a call. Screenshot below.
Comment #16
mgiffordThe patch currently uses:
background: buttonText;which seems like the best practice from:https://polypane.app/blog/forced-colors-explained-a-practical-guide/
Differentiating semantically between buttons and links is good, and the use of
LinkTextcan do that, but these are buttons.Now possibly we should be using
ButtonFaceorButtonBorderSome other links.
This is all still quite new:
https://drafts.csswg.org/css-color/#css-system-colors
Whether it is
buttonTextorbuttonFace(or even if it werelinkText) in many ways doesn't matter in terms of the barrier associated with this. It is visible in forced colors mode from what I've been able to tell.Comment #17
mgiffordSo with this patch, the button isn't disappearing. But I think it should be a button not a link with the role button.
Comment #18
kentr commented@mgifford, changing it to a
buttoninstead of a link withrole="button"is part of #3619154: Accessibility fixes for Admin theme's toggle control.@mherchel, thanks for testing so thoroughly!
@mgifford's "Toggle-with-patch" video in #17 shows that the toggle button isn't
ButtonTextin its default state (it isButtonTextwhen the button is focused at ~00:01).If the the toggle button was
ButtonText, it would be yellow in the video because Edge Page Colors with the Night Sky theme mapsButtonTextto yellow.This distinct semantic coloring of buttons isn't visible with devtools forced-colors emulation, except by inspecting the element's styles. In the inspector, it can be seen in the computed background color of the
::beforepsuedo-element.I had also done testing to be 1000% certain; I modified the MR locally as part of that.
@mgifford and I discussed in Slack, and he said he'd like it fixed here instead of another issue (it was formerly part of #3619154: Accessibility fixes for Admin theme's toggle control).
So, I updated the MR with my test code to shortcut past more back and forth. Feel free to tweak it.
Here are before / after screenshots with the MR as it was and with the addition. I added the vanilla button to the DOM (
<button>This is my button</button>) to show that it's also yellow.Before:
After:
Since I can't review this now...
@mgifford, do you want to review the MR again in MS Edge Page Colors Night Sky theme? If not, maybe @f0ns can.
Comment #19
mherchelIf this code works for you, I'm happy with it.
Comment #20
f0ns commentedSorry I can't retest this, I don't run MS Edge unless there is another way.
Comment #21
mgiffordThis is great. Thanks for updating the patch @KentR and catching the visual difference in how the toggle is displayed.
@f0ns I love Edge in that it is at least one possible filter from Google knowing everything about me (while still using Chrome). Also some great accessibility enhancements like the voice in Reader Mode. That said, you can always check out:
https://cssence.com/2024/forced-colors-mode-strategies/
For Chrome and FF instructions.
Comment #24
catchCommitted/pushed to main and 11.x, thanks!