Skip to content

Commit

Permalink
Update no-underline modifier/mixin to work in IE11
Browse files Browse the repository at this point in the history
IE11 does not support the CSS Text Decoration Module Level 3 ‘text-decoration styling’ properties [1] [2], and only recognises `text-decoration` as a regular property with values of none, underline, etc – as defined in CSS2 [3].

As such, using `text-decoration-line` to ‘unset’ the underline does not work in IE11. We want to avoid re-setting the `text-decoration` property because when treated as shorthand (in browsers that support `text-decoration-styling` this resets the `text-decoration-thickness` property to `auto`.

Instead, use `:not(:hover):not(:active)` to remove the text-decoration except when hovered/active. `:not` is supported in IE9 and above. This means that the `no-underline` mixin / modifier will have no effect in IE8.

Unfortunately the pseudo-class plugin we use to display links in different states does not correctly handle `:not` when used like this, so the examples in the links page do not render correctly. Revert the changes to this example, adding a simpler example instead.

[1]: https://www.w3.org/TR/css-text-decor-3/#text-decoration
[2]: https://caniuse.com/text-decoration
[3]: https://www.w3.org/TR/2009/CR-CSS2-20090908/text.html#propdef-text-decoration

# Conflicts:
#	app/views/examples/links/index.njk
  • Loading branch information
36degrees committed Apr 30, 2021
1 parent ee1f3a0 commit 615d420
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions src/govuk/helpers/_links.scss
Original file line number Diff line number Diff line change
Expand Up @@ -288,16 +288,7 @@
/// @access public

@mixin govuk-link-style-no-underline {
&:link {
text-decoration-line: none;
}

&:hover,
&:active {
text-decoration-line: underline;
}

&:focus {
&:not(:hover):not(:active) {
text-decoration: none;
}
}
Expand Down

0 comments on commit 615d420

Please sign in to comment.