Skip to content
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

Merged
merged 2 commits into from Jun 16, 2021

Conversation

christopherthomasdesign
Copy link
Member

@christopherthomasdesign christopherthomasdesign commented Jun 11, 2021

Solves #2250

Uses both text-decoration-skip-ink: none; and text-decoration-skip: none; to stop the thick hover underlines from skipping the descenders. We have to use both because Safari supports text-decoration-skip and the other browsers support text-decoration-skip-ink. Fun!

Before (Safari)

Screenshot 2021-06-14 at 16 27 27

After (Safari)

Screenshot 2021-06-14 at 16 27 49

Before (Firefox)

Screenshot 2021-06-14 at 16 30 07

After (Firefox)

Screenshot 2021-06-14 at 16 30 36

Before (Chrome)

Screenshot 2021-06-14 at 16 32 03

After (Chrome)

Screenshot 2021-06-14 at 16 31 41

@christopherthomasdesign christopherthomasdesign added this to Needs review 🔍 in Design System Sprint Board via automation Jun 11, 2021
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2251 June 11, 2021 15:54 Inactive
@christopherthomasdesign christopherthomasdesign changed the title Link underline adjustment Avoid ink skipping on link hover state underlines Jun 11, 2021
@CharlotteDowns CharlotteDowns changed the title Avoid ink skipping on link hover state underlines Avoid link skipping on link hover state underlines Jun 14, 2021
@CharlotteDowns CharlotteDowns changed the title Avoid link skipping on link hover state underlines Avoid ink skipping on link hover state underlines Jun 14, 2021
@CharlotteDowns
Copy link
Contributor

Is it worth also including -webkit-text-decoration-skip: none; for safari 7-12 and safari and chrome for iOS 7 - 12.1?

@36degrees
Copy link
Member

Is it worth also including -webkit-text-decoration-skip: none; for safari 7-12 and safari and chrome for iOS 7 - 12.1?

We use autoprefixer which will take care of that for us, based on our browser support requirements.

@36degrees 36degrees linked an issue Jun 14, 2021 that may be closed by this pull request
@36degrees 36degrees removed this from Needs review 🔍 in Design System Sprint Board Jun 14, 2021
@36degrees 36degrees mentioned this pull request Jun 14, 2021
3 tasks
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!
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2251 June 14, 2021 13:34 Inactive
@36degrees 36degrees changed the title Avoid ink skipping on link hover state underlines Disable ink skipping for underlines in hover state Jun 14, 2021
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2251 June 14, 2021 15:21 Inactive
Copy link
Member

@hannalaakso hannalaakso left a 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 () => {
Copy link
Member

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?

Copy link
Member

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?

Copy link
Member

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 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Link hover states look blocky on Safari (and Firefox)
5 participants