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

Do not remove focus outline from disabled link buttons in forced colors mode #2265

Merged
merged 2 commits into from
Jul 9, 2021

Conversation

36degrees
Copy link
Contributor

@36degrees 36degrees commented Jul 2, 2021

SortSite flags this as a potential issue, referencing WCAG 2.0 F78:

The CSS outline or border style on this element makes it difficult or impossible to see the dotted link focus outline.

We apply a 3px transparent outline to focused buttons, which becomes the visible focus indicator in forced color mode when the other focus state changes to the background and box shadow are not visible.

Adding the --disabled modifier to link buttons (<a> elements styled as buttons) does not remove them from the tab index or make them non-interactive. They are still focusable and outside of forced color mode retain the rest of the focus state. Removing the outline means that users in High Contrast Mode who focus the 'disabled' link button will not have a visible focus indicator.

This change should not affect buttons, as disabled buttons are not focusable and so the :focus pseudo-selector should never apply to them.

Outside of forced color mode there should be no visible change, as the outline is transparent.

Before

Screenshot 2021-07-09 at 10 15 45

http://govuk-frontend-review.herokuapp.com/components/button/link-disabled/preview

After

Screenshot 2021-07-09 at 10 16 06

https://govuk-frontend-pr-2265.herokuapp.com/components/button/link-disabled/preview

Fixes #2127

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2265 July 2, 2021 15:34 Inactive
@36degrees
Copy link
Contributor Author

Wondering if we should also deprecate the --disabled modifier class (leaving the attribute selectors) – although that's not something we've done before I don't think – and create an issue to remove them in a future breaking release?

Styling link buttons to look disabled without being able to effectively make them non-interactive and non-focusable seems like a bad idea generally.

@36degrees
Copy link
Contributor Author

Written up an issue to remove the ability to style link buttons as disabled: #2271

@vanitabarrett
Copy link
Contributor

@36degrees Can you add this to the changelog and tag the issue to the [NEXT] release milestone?

@36degrees 36degrees changed the title Don’t remove focus outline from disabled link buttons Don’t remove focus outline from disabled link buttons in forced color mode Jul 9, 2021
36degrees added 2 commits July 9, 2021 11:36
SortSite flags this as a potential issue, referencing WCAG 2.0 F78 [1]:

> The CSS outline or border style on this element makes it difficult or impossible to see the dotted link focus outline.

Adding the `--disabled` modifier to link buttons (`<a>` elements styled as buttons) does not remove them from the tab index or make them non-interactive. From testing, they are still focusable and retain the rest of the focus state, so avoid trying to remove the outline.

This change should not effect buttons, as disabled buttons are not focusable and so the focus pseudo-selector should never apply to them.

[1]: https://www.w3.org/TR/WCAG20-TECHS/F78.html
@36degrees 36degrees force-pushed the disabled-link-button-focus-outline branch from bdf721c to d0f6f08 Compare July 9, 2021 10:37
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2265 July 9, 2021 10:38 Inactive
@36degrees 36degrees merged commit 8a749aa into main Jul 9, 2021
@36degrees 36degrees deleted the disabled-link-button-focus-outline branch July 9, 2021 10:50
@EoinShaughnessy EoinShaughnessy changed the title Don’t remove focus outline from disabled link buttons in forced color mode Do not remove focus outline from disabled link buttons in forced color mode Aug 17, 2021
@EoinShaughnessy
Copy link
Contributor

Have changed "Don't" in title to "Do not." We'll be linking to this PR from our next release notes and many users have difficulties with negative contractions.

@EoinShaughnessy EoinShaughnessy changed the title Do not remove focus outline from disabled link buttons in forced color mode Do not remove focus outline from disabled link buttons in forced colors mode Aug 17, 2021
@vanitabarrett vanitabarrett mentioned this pull request Sep 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SortSite flags removal of focus outline from disabled buttons
4 participants