-
Notifications
You must be signed in to change notification settings - Fork 12
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
Update focus styles #822
Update focus styles #822
Conversation
This doesn't seem like a class that's used anymore
Not sure if this is a change that we will keep
@@ -83,11 +83,12 @@ $color-green-light: #4aa564; | |||
$color-gold-lightest: #fff1d2; | |||
$color-gold-lighter: #fad980; | |||
$color-gold-light: #f9c642; | |||
$color-gold-50v: #936F38; // This is something that's not in USWDS 1.6 |
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.
This is copied from the USWDS token based on an issue discussion.
This should be done before merge. Work is being done here to make it possible: - department-of-veterans-affairs/veteran-facing-services-tools#822
We're sticking with the double box-shadow for links in the header & footer, but going with the outline approach for links in the main content area due to the possibility of wrapping
@mixin focus-gold-lighter-highlight { | ||
background: $color-gold-lighter; | ||
outline: 2px solid $color-gold-lighter; | ||
outline-offset: 0; |
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.
I removed this because it was related and it didn't seem used. I saw it was added in 1b95985, but I couldn't find a PR for it. I also did two different git bisect
s in vets-website
so I could try to pin down:
- Where the
formation
version changed to3.0.0
- I don't think this was useful because we don't have any release notes tied to versions - I was just going off of the tag on the commit
- Where
focus-gold-lighter-highlight
was used invets-website
.
I didn't find it anywhere but I may have taken a wrong direction in a bisect and missed it, especially if it was around for a short amount of time.
@mixin focus-gold-vivid-outline { | ||
box-shadow: 0 0 0 3px $color-white, 0 0 4px 6px $color-gold-50v; | ||
outline: none; |
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.
Changing the mixin name means that we'll have to make a few changes in vets-website
(and might make this a "breaking change" technically):
I did it since we aren't using the gold-light
color anymore and I thought it would be good for the mixin name to not reference the old color.
@@ -206,8 +206,7 @@ $level-3-hover-padding: 8px 12px 8px 30px; | |||
} | |||
|
|||
&:focus { | |||
outline: 2px solid $color-gold; | |||
outline-offset: 3px; | |||
@include focus-gold-vivid-outline; |
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.
I don't think this is actually used anywhere, but I felt like removing it was out of scope for the PR. I updated it just to keep things consistent.
veteran-facing-services-tools/packages/formation/sass/modules/_m-nav-sidebar.scss
Lines 198 to 212 in ce8e5ff
& .menu-item-container { | |
& > a { | |
font-weight: bold; | |
} | |
&:hover { | |
background-color: $color-gray-lightest; | |
color: $color-blue; | |
} | |
&:focus { | |
outline: 2px solid $color-gold; | |
outline-offset: 3px; | |
} | |
} |
It's even unused in the sidenav.js
file:
@@ -35,7 +35,7 @@ body { | |||
&:focus { | |||
position: inherit; | |||
top: auto; | |||
outline: 2px solid $color-gold; | |||
@include focus-gold-vivid-outline; |
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.
This is for the "Skip to content" link at the top of the page.
@@ -1,6 +1,6 @@ | |||
{ | |||
"name": "@department-of-veterans-affairs/formation", | |||
"version": "7.0.1", | |||
"version": "8.0.0", |
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.
The major version change is because the mixin rename means that sass will throw an error when it tries to compile files that are using the old focus-gold-light-outline
. Let me know if you think this should be something lower.
This is from a yarn build
in vets-website
after I linked the local packages:
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.
Major version seems appropriate here 👍
&:focus { | ||
outline: $focus-outline; | ||
background: $color-white; | ||
color: $color-link-default; | ||
box-shadow: unset; |
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.
The gold outline gives us color contrast on light backgrounds, and setting the focused element's background to white and giving it a darker text ensures that we'll have good contrast for links on dark backgrounds.
This reverts commit 3a6a902.
Description
Part of department-of-veterans-affairs/vets-design-system-documentation#654
Companion PR: department-of-veterans-affairs/component-library#433
I left review comments, but links that aren't in the header/footer aren't getting the box-shadow styles because they could wrap, and box-shadow focus styling would look bad. Keeping the outline like we currently have (but with a different color) and setting the color to be dark and the background to be light should ensure that a focused link will have good contrast no matter where it appears.
Testing done
yarn link
and tested builds invets-website
andcontent-build
Screenshots
Example of focus styling for buttons, links, and wrapped links where the ends are far apart
Example where wrapped links are stacked underneath
Acceptance criteria
Definition of done