Skip to content

Commit

Permalink
Remove overlap between hover and focus styling (#609)
Browse files Browse the repository at this point in the history
* Remove overlap between Button hover and focus styles

* Remove overlap between Breadcrumb hover and focus styles

* Remove overlap between Link hover and focus styles

* Remove :disabled selector

---------

Co-authored-by: Vincent Smedinga <[email protected]>
  • Loading branch information
alimpens and VincentSmedinga authored Oct 11, 2023
1 parent f03e527 commit 425b4c1
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 62 deletions.
4 changes: 1 addition & 3 deletions packages/css/src/breadcrumb/breadcrumb.scss
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,7 @@
text-transform: capitalize;
}

&:focus,
&:hover,
&:active {
&:hover {
color: var(--amsterdam-breadcrumb-item-link-hover-color);
text-decoration: underline;
text-decoration-thickness: 2px;
Expand Down
15 changes: 3 additions & 12 deletions packages/css/src/button/button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,7 @@
}
}

// Specificity hack to be able to style secondary button focus state
// This isn't currently possible with the Utrecht component
// We should really pull this component in our own repo...
.amsterdam-button--secondary.amsterdam-button--secondary {
&:focus {
color: var(--amsterdam-button-secondary-focus-color);
}
}

.amsterdam-button--secondary:focus:not(:disabled, [aria-disabled="true"]) {
.amsterdam-button--secondary:focus:not(:hover, [aria-disabled="true"]) {
box-shadow: var(--amsterdam-button-secondary-focus-box-shadow);
}

Expand All @@ -52,6 +43,6 @@
}
}

.amsterdam-button--tertiary:focus:not(:disabled, [aria-disabled="true"]) {
box-shadow: var(--amsterdam-button-tertiary-focus-box-shadow);
.amsterdam-button--tertiary:focus:not(:hover, [aria-disabled="true"]) {
box-shadow: none;
}
48 changes: 17 additions & 31 deletions packages/css/src/link/link.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@
font-weight: var(--amsterdam-link-font-weight);
outline-offset: var(--amsterdam-link-outline-offset);

&:hover,
&:active,
&:focus {
color: var(--amsterdam-link-focus-color);
&:hover {
color: var(--amsterdam-link-hover-color);
}

@include reset;
Expand All @@ -31,11 +29,9 @@
text-decoration-thickness: var(--amsterdam-link-standalone-text-decoration-thickness);
text-underline-offset: var(--amsterdam-link-standalone-text-underline-offset);

&:hover,
&:active,
&:focus {
text-decoration-thickness: var(--amsterdam-link-standalone-focus-text-decoration-thickness);
text-underline-offset: var(--amsterdam-link-standalone-focus-text-underline-offset);
&:hover {
text-decoration-thickness: var(--amsterdam-link-standalone-hover-text-decoration-thickness);
text-underline-offset: var(--amsterdam-link-standalone-hover-text-underline-offset);
}

@media screen and (width > $amsterdam-breakpoint) {
Expand All @@ -50,11 +46,9 @@
text-decoration: var(--amsterdam-link-inline-text-decoration);
text-decoration-thickness: var(--amsterdam-link-text-decoration-thickness);

&:hover,
&:active,
&:focus {
text-decoration: var(--amsterdam-link-inline-focus-text-decoration);
text-underline-offset: var(--amsterdam-link-inline-focus-text-underline-offset);
&:hover {
text-decoration: var(--amsterdam-link-inline-hover-text-decoration);
text-underline-offset: var(--amsterdam-link-inline-hover-text-underline-offset);
}

&:visited {
Expand All @@ -70,12 +64,10 @@
line-height: var(--amsterdam-link-in-list-line-height);
text-decoration: var(--amsterdam-link-in-list-text-decoration);

&:hover,
&:active,
&:focus {
text-decoration: var(--amsterdam-link-in-list-focus-text-decoration);
text-decoration-thickness: var(--amsterdam-link-in-list-focus-text-decoration-thickness);
text-underline-offset: var(--amsterdam-link-in-list-focus-text-underline-offset);
&:hover {
text-decoration: var(--amsterdam-link-in-list-hover-text-decoration);
text-decoration-thickness: var(--amsterdam-link-in-list-hover-text-decoration-thickness);
text-underline-offset: var(--amsterdam-link-in-list-hover-text-underline-offset);
}

@media screen and (width > $amsterdam-breakpoint) {
Expand All @@ -94,9 +86,7 @@
.amsterdam-link--on-background-dark {
color: var(--amsterdam-link-on-background-dark-color);

&:hover,
&:active,
&:focus {
&:hover {
color: var(--amsterdam-link-on-background-dark-hover-color);
}

Expand All @@ -108,9 +98,7 @@
.amsterdam-link--on-background-light {
color: var(--amsterdam-link-on-background-light-color);

&:hover,
&:active,
&:focus {
&:hover {
color: var(--amsterdam-link-on-background-light-hover-color);
}

Expand All @@ -121,12 +109,10 @@

.amsterdam-link--inline.amsterdam-link--on-background-dark,
.amsterdam-link--inline.amsterdam-link--on-background-light {
text-decoration: var(--amsterdam-link-inline-focus-text-decoration);
text-underline-offset: var(--amsterdam-link-inline-focus-text-underline-offset);
text-decoration: var(--amsterdam-link-inline-hover-text-decoration);
text-underline-offset: var(--amsterdam-link-inline-hover-text-underline-offset);

&:hover,
&:active,
&:focus {
&:hover {
text-decoration: var(--amsterdam-link-inline-text-decoration);
}
}
10 changes: 1 addition & 9 deletions proprietary/tokens/src/components/amsterdam/button.tokens.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@
},
"focus": {
"box-shadow": {
"value": "inset 0 0 0 3px {amsterdam.color.dark-blue}"
},
"color": {
"value": "{amsterdam.color.dark-blue}"
"value": "inset 0 0 0 2px {amsterdam.color.primary-blue}"
}
}
},
Expand All @@ -35,11 +32,6 @@
"box-shadow": {
"value": "inset 0 0 0 2px {amsterdam.color.neutral-grey3}"
}
},
"focus": {
"box-shadow": {
"value": "inset 0 0 0 2px {amsterdam.color.neutral-grey3}"
}
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions proprietary/tokens/src/components/amsterdam/link.tokens.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
"font-weight": {
"value": "{amsterdam.typography.font-weight.normal}"
},
"focus": {
"hover": {
"color": { "value": "{amsterdam.color.dark-blue}" }
},
"inline": {
"focus": {
"hover": {
"text-decoration": { "value": "underline" },
"text-underline-offset": { "value": "3px" }
},
Expand All @@ -33,7 +33,7 @@
},
"in-list": {
"gap": { "value": "0.5em" },
"focus": {
"hover": {
"text-decoration": { "value": "underline" },
"text-decoration-thickness": { "value": "2px" },
"text-underline-offset": { "value": "7px" }
Expand All @@ -50,7 +50,7 @@
"standalone": {
"text-underline-offset": { "value": "8px" },
"text-decoration-thickness": { "value": "2px" },
"focus": {
"hover": {
"text-decoration-thickness": { "value": "3px" },
"text-underline-offset": { "value": "7px" }
},
Expand Down
4 changes: 1 addition & 3 deletions proprietary/tokens/src/components/utrecht/button.tokens.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@
"color": {}
},
"focus": {
"background-color": {
"value": "{amsterdam.color.dark-blue}"
},
"background-color": {},
"border-color": {},
"border-width": {}
},
Expand Down

0 comments on commit 425b4c1

Please sign in to comment.