-
Notifications
You must be signed in to change notification settings - Fork 334
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
Disable ink skipping for underlines in hover state #2251
Conversation
Is it worth also including |
We use autoprefixer which will take care of that for us, based on our browser support requirements. |
The thick underlines we use in the new hover states are rendered differently by different browsers. In Safari and Firefox, links can look messy if the link text contains words with lots of descenders. Disable ink skipping on hover, which means that links look closer to the way they do in Safari currently. Use both `text-decoration-skip-ink: none;` and `text-decoration-skip: none;` – Safari supports `text-decoration-skip` whilst other browsers support `text-decoration-skip-ink`. Fun!
386e47d
to
e873ed5
Compare
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've tested the hover state the following and it looks great 🎉
✅ Safari 14 on Mac
✅ FF 89 on Mac (inc inverted colours)
✅ FF 89 on Windows
✅ Chrome 91 on Mac
✅ Chrome 91 on Windows
✅ iOS 14 Safari
✅ Android 11 Chrome
@@ -121,7 +121,7 @@ describe('@mixin govuk-link-hover-decoration', () => { | |||
}) | |||
|
|||
describe('when $govuk-new-link-styles are enabled', () => { | |||
it('sets text-decoration-thickness on hover', async () => { | |||
it('sets a hover state', async () => { |
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.
Should we leave this test as it is, and add a new test for ink skipping that tests for the presence of the styles?
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 test has to change because it no longer passes:
● @mixin govuk-link-hover-decoration › when $govuk-new-link-styles are enabled › sets text-decoration-thickness on hover
expect(received).toContain(expected) // indexOf
Expected substring: ".foo:hover { text-decoration-thickness: 10px; }"
Received string: ".foo:hover { text-decoration-thickness: 10px; text-decoration-skip-ink: none; text-decoration-skip: none; }
We could add tests for each of the properties, but I don't think we want to test the CSS itself, just the logic that surrounds it. In this case, we want to know how the mixin behaves differently depending on the various link settings:
- by default there's no hover state
- when
$govuk-new-link-styles
are enabled, there is a hover state (but we don't care exactly what that hover state looks like – that's what manual testing is for) - except when
$govuk-link-hover-underline-thickness
is falsey, in which case the hover state is removed
I think the revised tests cover this. What do you think?
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 @36degrees that covers it 👍
Solves #2250
Uses both
text-decoration-skip-ink: none;
andtext-decoration-skip: none;
to stop the thick hover underlines from skipping the descenders. We have to use both because Safari supportstext-decoration-skip
and the other browsers supporttext-decoration-skip-ink
. Fun!Before (Safari)
After (Safari)
Before (Firefox)
After (Firefox)
Before (Chrome)
After (Chrome)