-
Notifications
You must be signed in to change notification settings - Fork 81
Remove :hover:visited styles and decrease base link specificity (Fix #1071) #1077
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
Changes from all commits
9e81e70
18b2d3d
0a6ffe5
43d5886
1ac1544
78d8b51
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,12 +4,22 @@ | |
|
|
||
| @use '../../includes/lib' as *; | ||
|
|
||
| :link { | ||
| // Rely on source order for the stateful style overrides | ||
| // 1. Visited | ||
| // 2. Hover | ||
| // 3. Active | ||
| // 4. Focus | ||
|
|
||
| a { | ||
| color: $link-color; | ||
| text-decoration: underline; | ||
|
|
||
| // where is used to decrease specificity to avoid conflicts with button styles | ||
| &:where(:visited) { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion (non-blocking) Might be worth putting the comment in code so it's clear why |
||
| color: $link-color-visited; | ||
| } | ||
|
|
||
| &:hover, | ||
| &:focus, | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Declaring the colour change on focus was the root problem in #842
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I could split the definition and keep the |
||
| &:active { | ||
| color: $link-color-hover; | ||
| text-decoration: none; | ||
|
|
@@ -22,30 +32,13 @@ | |
| @supports (--css: variables) { | ||
| color: var(--link-color); | ||
|
|
||
| &:hover, | ||
| &:focus, | ||
| &:active { | ||
| color: var(--link-color-hover); | ||
| &:where(:visited) { | ||
| color: var(--link-color-visited); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| :visited { | ||
| color: $link-color-visited; | ||
|
|
||
| &:hover, | ||
| &:focus, | ||
| &:active { | ||
| color: $link-color-visited-hover; | ||
| } | ||
|
|
||
| @supports (--css: variables) { | ||
| color: var(--link-color-visited); | ||
|
|
||
| &:hover, | ||
| &:focus, | ||
| &:active { | ||
| color: var(--link-color-visited-hover); | ||
| color: var(--link-color-hover); | ||
| } | ||
| } | ||
| } | ||
|
|
||
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 couldn't decrease the specificity enough for
:visitedwith re-arranging things alone.I think using
:whereonly on the visited links is good progressive enhancement. Older browsers will still be able to see and interact with links without any problem. Newer browsers get the visual indication of visited as well.Maybe this is the best of both worlds from @maureenlholland's #1054