-
Notifications
You must be signed in to change notification settings - Fork 33
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
[a11y] Button
and Link
high contrast outline issue fix
#847
base: main
Are you sure you want to change the base?
Conversation
|
🟢 No design token changes found |
|
…be visible in high contrast themes
Button
and Link
high contrast outline issue fix
Looks great @stamat, thank you! Thanks for raising this, I'd not actually tested with Windows high-contrast themes before. It looks like our icons could do with switching to a different colour in some scenarios. Are you seeing the same thing that I'm seeing here (dark grey arrow icon is barely visible)? Could you also add the Update snapshots label to this PR to regenerate the snapshots please? |
@joshfarrant I'll take a deeper look into this man in few moments! I didn't know there was an icon lol... |
Sorry @stamat, I wasn't suggesting this was something you had to fix 😅 I just wanted to ask out of curiosity as I've not tested with Windows high-contrast themes before and I wanted to make sure I wasn't missing something obvious. I'm happy to take a look through all our components at some point in the future and make sure they're working as well as possible in high-contrast. |
.Button--primary, | ||
.Button--secondary, | ||
.Button--disabled:hover { | ||
outline: var(--brand-borderWidth-thick) solid transparent; | ||
outline-offset: 2px; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI these styles were put in place by our accessibility engineering team to resolve similar issues in Windows HCM.
Before we undo that work (and for my own understanding), do the changes in this PR take precedence? cc. @TylerJDev who was involved in the original PR, if you have any thoughts too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rezrah I completely failed to understand how these button updates that I removed helped accessibility, seemed they had an opposite effect based on my understanding... Yeah it's a good call to ask @TylerJDev to shed some light on this. I'm all 👂 ! 🙏 ❤️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rezrah I think I know what happened... Our old(er) buttons probably didn't have a border but used an inset box-shadow... https://github.com/primer/brand/blob/d763e2fb6584489f1277370457b4c2ebded2fd82/packages/react/src/Button/Button.module.css (This is the state from the era the change was made)
So this "fix" used the outline to draw the border in high contrast themes since backgrounds and shadows are disabled - instead of just adding the border!?
The reason older buttons had the box-shadow borders was to animate them escaping the jitter of the border, thus sacrificing accessibility for aesthetics.
CSI Miami 😎
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello 👋
Looking at the change, and my own change, this was a time before borders were used for buttons, so we needed to add something to imitate the styles of box-shadow for HCM.
Since we've added borders to the button, we don't need to imitate the borders anymore, since those always show in HCM, so removing this is okay since it, and the focus styles. Right now it seems like the two are competing against each other, the outline provided in HCM and the border of the button.
As for the outline, this was more or less interchangeable with the border in HCM. I'm not too sure if there was another driving factor here, since it's been a minute 😅, but having there be some sort of presence of a border was the main goal to differentiate between what is/isn't a button.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TylerJDev thanks for the reply dude! 💖 Yeah I figured it was something like that!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for helping to fix this @stamat 💖 ... I've left you some minor feedback. Would love your thoughts on this in particular.
A few other things before this lands:
-
We'll need a changeset added to this PR to describe what changed in this PR for our release change log. You can do it by clicking this link on this comment 👇
-
Updated snapshots would be useful to verify there aren't any visual regressions. You can add the 'update snapshots' label in this PR to run the tests.
Co-authored-by: Rez <[email protected]>
Co-authored-by: Rez <[email protected]>
… button and the screen reader will read it as disabled. We need to track where the focus is visually
Also a note, I believe
I don't think this applies to buttons, for the buttons to be disabled we need to use |
@joshfarrant @rezrah one final ✅ from you 🙏 ! Also should I up a patch version? 😇 |
Summary
Outline of the
Button
component was always visible in high contrast themes which was causing a11y issues.Outline of the
Link
component was invisible in the high contrast themes which is also an a11y issue.Button
andLink
outlines on Windows 11 high contrast themes #846List of notable changes:
Button
component to be always visible regardless of the focus in high contrast themesLink
component to use the native outline instead of box-shadow, since box shadow is invisible in high contrast themesLink
component to use border instead of background so the underline will be visible in high contrast themesWhat should reviewers focus on?
Button
component should only be visible when the component is focused in high contrast themesLink
component should be visible when the component is focused in high contrast themesLink
component should be visible on hover in high contrast themesSteps to test:
npm run start
Supporting resources (related issues, external links, etc):
Contributor checklist:
update snapshots
label to the PR)Reviewer checklist:
Screenshots: