-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Switch toggles focus style #1562
Comments
I actually tried adding a focus style to this a while back, and it seems like the way it's built it's hard to add such a thing :| That doesn't mean it can't be done. It just means I couldn't get it done. But if we can't do it ever, we might want to look at an alternative. The reason I like the switch as a form element is that it not only implies something is being toggled, but that the choice is also saved right then and there. Contrast to a checkbox, which is usually accompanied by a "Save Changes" button. Given we can add a focus style to this switch, I like how Bear app does it: |
At Yoast, we use a similar UI control and we've implemented the focus style around the "knob" (built with two inner box-shadows). That's facilitated by the fact "our" toggle knob is a bit bigger, not sure a similar solution would fit the case of the Gutenberg switch toggle. Posting here for inspiration 🙂 |
I dig it. The visual style is less important, so long as we can add focus rectangles. Do you happen to have some markup we can look at? Thank you! |
Markup no :) The CSS in our case is something like:
but this would beed to be adjusted, also because in the Gutenberg switch the background color becomes blue when active. The basic idea is:
|
Hi all! For focus states, I'd consider using a style other than My coworker Joe made a Codepen demonstrating how You can try out High Contrast by opening up the Windows display settings! |
Hm, I'm afraid the High Contrast mode issue is something that hasn't been addressed in WordPress yet. Almost all focusable elements in the admin use box-shadow for the focus style. In Windows High Contrast mode there's basically no focus indication at all 😞 macOS instead seems to apply some outline. |
@afercia Sounds great! Looking forward to joining today. |
Worth noting support for Windows High Contrast Mode is also mentioned in the initial accessibility recommendation issue, see point 5. in #297 |
I've played a bit with this. By changing the Just as an example, not pretending these should be the final styles, I've tried to use some borders. Only the last style uses a border + box-shadow: Maybe worth experimenting a bit inverting background/border colors. |
It would be great to have some design idea for the switch toggles focus style:
/cc @jasmussen @melchoyce 🙂
The text was updated successfully, but these errors were encountered: