-
Notifications
You must be signed in to change notification settings - Fork 341
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
Link hover states are not clear #1417
Comments
I think it'd good to think about #1205 as well if we did this. |
Hover states in general could do with a review for example:
do not have hover states (perhaps more components too). |
Noticed the NHS seem to have responded to this challenge too (perhaps by DAC as well!). Main NHS.UK websiteNo interactionHover with a mouseFocus with a keyboardI think this approach could potentially be problematic because the hover and the focus style are so similar a user could be confused what they're focused on and accidentally interact with wrong element. Beta NHS.UK Service ManualLink with no interactionLink when hoveredLink when focusedThis approach seems to be: 'if there is an underline, remove it. If there is no underline, show one'. |
Dave Hunter has shared some of the working notes for this iteration:
Full document: https://docs.google.com/document/d/11AjdOgWC7ue1bit5AFyaneNwJYiudgLhf8nOxCWbn9M/edit# A note on how they recruited participants:
|
Hover statesI've been doing a bit of exploration into this issue. It's worth remembering that over 60% of GOV.UK users are on touch devices. So any work on hover states should only be seen as a small enhancement that acts as an extra affordance for mouse/trackpad users. It might be particularly helpful for people with cognitive impairments, low digital literacy or low vision. I prototyped some different approaches to hover states, you can have a look at these in more detail here: https://design-system-mess.herokuapp.com/ (username:design / password:mess) Removing or adding underlinesI started with an approach similar to the NHS example above – "if there is an underline, remove it; if there is no underline, show one". This ran into problems when using links on dark backgrounds, like in an interruption card (this component isn't currently in the Design System but many teams use it and it probably will exist in the future). If your link colour is the same as the text colour, and you remove the underline on hover, you lose the visual differentiator and it becomes unclear what you're selecting: LinkHoverYou can help this by using a tint of the original colour on hover. But then you run into the same problem we were trying to solve – the tint won't be distinct enough from the original link. I like the idea of not changing the colour on hover as a rule, and using a different visual change instead. It means that if your original link style is obviously a link and has enough colour contrast, the hover state will too. Changing underline stylesAn experiment I quite liked was using a thicker border on hover. I used an adapted version of the focus state styling, with a transparent background and the border at the bottom taking the same colour as the text: LinkHoverFocusClearly, the hover and focus states may be indistiguishable to users with certain visual impairments, or using screens that don't show certain colours very well. However I think there are two changes in state that are particularly important:
At the moment I'm not sure how different the hover and focus states need to be from one another. There’s the possibility that someone might navigate with both a keyboard and a mouse. Or with the mouse pointer left idle on the screen whilst tabbing through – that could make it unclear if a hover and a focus were showing at the same time. But not sure how common this is or what the impact would be. Any input on this would be appreciated. Next stepsWould be great to get any feedback on the ideas here or examples of how others have approached this. Will also try and get something like this example into some user research to see how it tests. Let me know if you've got any research coming up and would like to add some new hover states into your prototypes. |
We should also test what these different states look like cross browser/ operating system. |
We recently ran a round of accessibility research and included this change in the hover state. We had 6 participants, including people with cognitive, mild and moderate motor impairments and low vision. 3 participants used dragon, 1 had a special keyboard with large keys, 1 used zoom magnification. The hover states change didn’t effect any of our participants. The one participant with low vision did mention that he would have preferred the link to be a darker colour for greater contrast but he understood that it was a hyperlink. He zoomed in to use the hyperlink and increase the text size of it and he also had his iPhone on high contrast mode. Overall this particular change didn’t have an affect on how he navigated the site or carried out his task. This was the same for all participants. |
GOV.UK Design System working group reviewRepresentatives from the GOV.UK Design System working group reviewed a contribution for making hover states clearer in June 2020. Based on a majority vote, the group decided that:
They also made the following recommendations. Design
Code
Next stepsBased on this feedback, the GOV.UK Design System team and the contributor have agreed to:
|
We received some useful feedback from the Working Group for making hover styles clearer and will do some exploration to answer their questions. Summary of Working Group feedback WhyNew hover styles could be a breaking change for some users so we want to use the feedback from the WG to ensure that the hover styles work for different edge cases. Done when
We have tested how the hover styles work for:
As indicated to the WG, we also have post-review actions to:
We should also:
|
I just looked at this in the preview and the underline seems to almost touch the following line (Win 10 & Google Chrome). The focus state doesn't have this issue. Maybe adding a white background will sort the issue in a similar way. |
Hover state for white text behind coloured backgroundBackground:Over on GOV.UK we needed to address the hover state for white text behind a coloured background. The situation arose on the COVID-19 page, where the Rather than find a solution for this one scenario, is there a solution that works throughout GOV.UK? Coronavirus HeaderDiscovery:When hovering over a white text behind a coloured background the colour of the text will change from govuk-colour("white") = This colour was discovered when experimenting the limits of adding shade/darkening the white text, all the while complying with a11y standards of 4.5:1 colour contrast ratio, the AA grade for font-sizes that is less than Experimentation/Discovery was made in this Figma file Initial implementationUpdate will be made to the Next stepsSee what feedback is within the community, based on that we can roll it out throughout GOV.UK |
Related PR raised |
Browser support for It looks like that issue should be fixed in Chrome 90, which becomes stable in April. As Edge and Opera are both built on top of Chromium, I'd expect both of those browsers to be updated with the same fix not long after. Using text-decoration-thickness would allow us to do something like this, if we wanted: Screen.Recording.2021-01-27.at.09.23.41.movIt would need to be considered an enhancement as it would not work in IE11, Edge < 90 Early 2021), Chrome < 90 (April 2021), Safari < 12.1 (March 2019), Firefox < 70 (October 2019) – unless we also set the color or offset. |
New link styles and hover statesI've been doing some more work on links, building on Ollie's work above. I'm trying to solve two problems here:
The increasing support for a few CSS properties means we can now control more about how links look. I've had a go at making links that:
It's worth reiterating that these changes should be seen as an enhancement. For browsers that don't support some or all of these properties, the normal underline will still work. Proposed designLook at the work in Frontend at #2089. Still some details to iron out, but something like this. Before: After: I've added the following CSS to links:
It makes all link underlines 1px thick, sits them a bit further below the baseline of the text, and uses a lighter shade of blue to make the line a bit visually lighter. For the hover state, I made the line thicker and brought back the original link colour to make it stronger:
Here's how that scales for different sized text: ConsiderationsDifferent coloured links and backgroundsThe use of I think we'd want to be fairly confident that any underline colour has at least 3:1 contrast with the background to pass 1.4.11 Non-text Contrast. If something like that's not possible, we could either:
Distance from the baselineFor some reason, every browser's implementation of On all browsers, the combination of Another thing we could look at doing is making the underline offset on hover the same distance from the baseline as our focus state border. Again, I don't think there are huge gains here but it might look a bit more elegant or less jumpy. Testing across browsers and versionsI've done a bit of this but it would be good to test a bit more thoroughly on different versions and devices. |
We sent the revised implementation of link styles and hover states to the working group in March 2021. The group approved the changes, with the following main feedback:
We'll need to do a little bit more exploration to address these, covered in alphagov/govuk-design-system#1578 |
We have a long-standing issue (#1417) [1] from an audit in May 2019 about the link hover state not being clear: > The colour change when a user hovers over a link is not clear and this was especially difficult for low vision users to determine. > > Ensuring that the state change is distinctive would benefit low vision users in particular, while benefiting all mouse users in general. This was raised as a usability issue rather than a WCAG failure. We’ve been keeping an eye on browser support for the `text-decoration-thickness` property, and its introduction into Chrome 87 means that all evergreen browsers now support it. We can therefore use `text-decoration-thickess` as a way to differentiate the link on hover. Some of the rationale for this is included in a comment around the time of the previous working group review [2]. The broad intention is that the thicker underline is a state change that can work across any combination of text colour and background colour, as long as the link has enough contrast in its default state. We set the underline to a minimum width to 3px with a max to 0.12em. The aim is to make the state change clear whilst avoiding the underline crashing into the text below at larger sizes. A minimum 3px width ensures at least a 2px change from the default 1px thickness. It’s a bit close with 16px body-s text, but if you set the minimum width too low, the hover thickness at 19px stays too thin. [3] We're retaining the existing colour change on hover, as without the colour change there would be no state change in browsers that don't support `text-decoration-thickness`, including IE11. We can revisit this decision as and when our browser support requirements change. [4] [1]: #1417 [2]: #1417 (comment) [3]: alphagov/govuk-design-system#1578 (comment) [4]: alphagov/govuk-design-system#1578 (comment) Co-authored-by: Chris Thomas <christopher.thomas@digital.cabinet-office.gov.uk>
We have a long-standing issue (#1417) [1] from an audit in May 2019 about the link hover state not being clear: > The colour change when a user hovers over a link is not clear and this was especially difficult for low vision users to determine. > > Ensuring that the state change is distinctive would benefit low vision users in particular, while benefiting all mouse users in general. This was raised as a usability issue rather than a WCAG failure. We’ve been keeping an eye on browser support for the `text-decoration-thickness` property, and its introduction into Chrome 87 means that all evergreen browsers now support it. We can therefore use `text-decoration-thickess` as a way to differentiate the link on hover. Some of the rationale for this is included in a comment around the time of the previous working group review [2]. The broad intention is that the thicker underline is a state change that can work across any combination of text colour and background colour, as long as the link has enough contrast in its default state. We set the underline to a minimum width to 3px with a max to 0.12em. The aim is to make the state change clear whilst avoiding the underline crashing into the text below at larger sizes. A minimum 3px width ensures at least a 2px change from the default 1px thickness. It’s a bit close with 16px body-s text, but if you set the minimum width too low, the hover thickness at 19px stays too thin. [3] We're retaining the existing colour change on hover, as without the colour change there would be no state change in browsers that don't support `text-decoration-thickness`, including IE11. We can revisit this decision as and when our browser support requirements change. [4] [1]: #1417 [2]: #1417 (comment) [3]: alphagov/govuk-design-system#1578 (comment) [4]: alphagov/govuk-design-system#1578 (comment) Co-authored-by: Chris Thomas <christopher.thomas@digital.cabinet-office.gov.uk> Co-authored-by: Charlotte Downs <charlotte.downs@digital.cabinet-office.gov.uk>
We have a long-standing issue (#1417) [1] from an audit in May 2019 about the link hover state not being clear: > The colour change when a user hovers over a link is not clear and this was especially difficult for low vision users to determine. > > Ensuring that the state change is distinctive would benefit low vision users in particular, while benefiting all mouse users in general. This was raised as a usability issue rather than a WCAG failure. We’ve been keeping an eye on browser support for the `text-decoration-thickness` property, and its introduction into Chrome 87 means that all evergreen browsers now support it. We can therefore use `text-decoration-thickess` as a way to differentiate the link on hover. Some of the rationale for this is included in a comment around the time of the previous working group review [2]. The broad intention is that the thicker underline is a state change that can work across any combination of text colour and background colour, as long as the link has enough contrast in its default state. We set the underline to a minimum width to 3px with a max to 0.12em. The aim is to make the state change clear whilst avoiding the underline crashing into the text below at larger sizes. A minimum 3px width ensures at least a 2px change from the default 1px thickness. It’s a bit close with 16px body-s text, but if you set the minimum width too low, the hover thickness at 19px stays too thin. [3] We're retaining the existing colour change on hover, as without the colour change there would be no state change in browsers that don't support `text-decoration-thickness`, including IE11. We can revisit this decision as and when our browser support requirements change. [4] [1]: #1417 [2]: #1417 (comment) [3]: alphagov/govuk-design-system#1578 (comment) [4]: alphagov/govuk-design-system#1578 (comment) Co-authored-by: Chris Thomas <christopher.thomas@digital.cabinet-office.gov.uk> Co-authored-by: Charlotte Downs <charlotte.downs@digital.cabinet-office.gov.uk>
This issue is from a May 2019 external accessibility audit report.
WCAG Reference: Usability feedback only, there is no WCAG related guidelines.
Issue ID: DAC_Issue33
URL: Throughout
Screen Shot
Before hover
On hover
The colour change when a user hovers over a link is not clear and this was especially difficult for low vision users to determine.
Ensuring that the state change is distinctive would benefit low vision users in particular, while benefiting all mouse users in general.
Current Code Ref(s)
$govuk-link-colour #005ea5 $govuk-link-hover-colour #2b8cc4
Low vision user comments
Solution
Offer a clearer colour change i.e. similar to that of the keyboard focus, or add/remove an underline when users hover over the links/buttons.
The text was updated successfully, but these errors were encountered: