-
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
Use text colour on focus for better contrast #982
Conversation
|
||
// When focussed, the text colour needs to be darker to ensure that colour | ||
// contrast is still acceptable | ||
&:focus { |
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 tried changing the focusable mixin and that led to ordering problems since focus was not the last selector.
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.
Do you think this would be easy to fix?
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.
It just felt fragile having to move lots of code around to get the ordering right, we can explore it more, it would be nice to have it in the mixin.
I think one to do together if we decide to explore that.
c6d93db
to
74ab674
Compare
Yeah, we don't do it in any other component that might include links, so I agree we should be thinking about removing this. |
@36degrees I have added an additional commit to address your feedback about the header component |
@@ -137,18 +137,18 @@ | |||
<section class="govuk-!-margin-top-8"> | |||
<h2 class="govuk-heading-l govuk-!-padding-bottom-2" style="border-bottom: 4px solid;">Lists</h2> | |||
<h3 class="govuk-heading-m">govuk-list</h3> | |||
<ul class="govuk-list govuk"> |
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.
If we're not sure about keeping the list link styling, do we want to keep these classes for now?
@@ -42,6 +42,9 @@ | |||
// -1px offset fixes gap between background and outline in Firefox |
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.
Non-blocking: I wonder if we should make it possible to pass an offset to the focusable
helper, to avoid this duplication? As far as I can tell, the 1px offset is the only reason this isn't using the helper.
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 think the width of the outline itself is different too... I think best for another pull request.
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.
👍
color: $govuk-error-colour; | ||
text-decoration: underline; |
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.
Is this just for consistency with the link styles, relying on the browser default?
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.
As far as I could tell, this did nothing?
src/components/header/_header.scss
Outdated
&:focus { | ||
color: govuk-colour("black"); | ||
color: $govuk-text-colour; |
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.
👍
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.
Actually, I'm wondering if this should be a different application? Thinking about (admittedly future) things like whitelabelling, coupling focus text colour to always being the same as the text colour might not always be what users want to do? For example, depending on the focus colour, white might be a better choice.
$govuk-focus-text-colour: govuk-colour("black") !default;
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.
Yeah I like that, we should definitely do that.
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.
Hmm, maybe we could do this later to be honest, I've done a commit but wonder if thinking about theming holistically with everything else would be better than adding it piecemeal.
ca5b1e0
to
29b2404
Compare
Also removes `text-decoration: underline` since it is not being used.
29b2404
to
de1c426
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.
Have tested by fixing the linting error and running the app locally and this is looking good – just a couple of minor things to address and then I think we can merge this 🎉
src/settings/_colours-applied.scss
Outdated
@@ -127,4 +136,4 @@ $govuk-link-hover-colour: govuk-colour("light-blue") !default; | |||
/// @type Colour | |||
/// @access public | |||
|
|||
$govuk-link-active-colour: govuk-colour("light-blue") !default; | |||
$govuk-link-active-colour: govuk-colour("light-blue") !default; |
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.
Minor, but looks like you've removed the new line from the end of this file.
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.
Looks like the linter's picked up on this as well, which I think is why the tests (and the review app) are now failing.
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.
All hail the linter
/// Focused text colour | ||
/// | ||
/// Ensure that the contrast between the text and background colour passes | ||
/// WCAG Level AA contrast requirements. |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
a7c354e
to
16a6272
Compare
@36degrees updated as per your feedback, thanks Ollie. |
I think I've broken the 'no visited state', definitely have, so block merging until I resolve that. |
This comment has been minimized.
This comment has been minimized.
Makes this class consistent with the other selectors. Unfortunately due to specificity we need to duplicate the pseudo selectors. This also fixes the hover state for the no visited state links.
28f6aee
to
2c1271d
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.
Great work 👏
👏 |
This reverts commit 6a007a7. The issue in question has been beautifully handled by the Design System Team[1] and no longer needs to exist in our codebase. Going back to the standard GOV.UK Frontend for consistency and easier upgrades. [1]: alphagov/govuk-frontend#982
This reverts commit 6a007a7. The issue in question has been beautifully handled by the Design System Team[1] and no longer needs to exist in our codebase. Going back to the standard GOV.UK Frontend for consistency and easier upgrades. [1]: alphagov/govuk-frontend#982
This reverts commit 6a007a7. The issue in question has been beautifully handled by the Design System Team[1] and no longer needs to exist in our codebase. Going back to the standard GOV.UK Frontend for consistency and easier upgrades. [1]: alphagov/govuk-frontend#982
Closes #944
This pull request updates the focus styles of links in GOV.UK Frontend so they pass WCAG contrast requirements.
You can compare https://govuk-frontend-review-pr-982.herokuapp.com/examples/links vs https://govuk-frontend-review.herokuapp.com/examples/links
Screenshots
back link
breadcrumbs
details
skip link
header
govuk-link
https://trello.com/c/XQPpwofN/1381-1-modify-focus-state-to-use-text-colour