-
Notifications
You must be signed in to change notification settings - Fork 320
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
Changes from all commits
3c78f95
0125d65
a1922cb
37421a5
45b6d06
2c1271d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,10 +49,14 @@ | |
&:link, | ||
&:visited, | ||
&:hover, | ||
&:active, | ||
&:focus { | ||
&:active { | ||
color: $govuk-error-colour; | ||
text-decoration: underline; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. As far as I could tell, this did nothing? |
||
} | ||
|
||
// When focussed, the text colour needs to be darker to ensure that colour | ||
// contrast is still acceptable | ||
&:focus { | ||
color: $govuk-focus-text-colour; | ||
} | ||
|
||
// alphagov/govuk_template includes a specific a:link:focus selector | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,12 @@ | |
&:active { | ||
color: $govuk-link-active-colour; | ||
} | ||
|
||
// 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 commentThe 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 commentThe 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 commentThe 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. |
||
color: $govuk-focus-text-colour; | ||
} | ||
} | ||
|
||
/// Muted style link mixin | ||
|
@@ -73,7 +79,7 @@ | |
// When focussed, the text colour needs to be darker to ensure that colour | ||
// contrast is still acceptable | ||
&:focus { | ||
color: $govuk-text-colour; | ||
color: $govuk-focus-text-colour; | ||
} | ||
|
||
// alphagov/govuk_template includes a specific a:link:focus selector designed | ||
|
@@ -122,6 +128,51 @@ | |
} | ||
} | ||
|
||
|
||
/// No visited state link mixin | ||
/// | ||
/// Used in cases where it is not helpful to distinguish between visited and | ||
/// non-visited links. | ||
/// | ||
/// For example, navigation links to pages with dynamic content like admin | ||
/// dashboards. The content on the page is changing all the time, so the fact | ||
/// that you’ve visited it before is not important. | ||
/// | ||
/// If you use this mixin in a component you must also include the | ||
/// govuk-link-common mixin in order to get the focus state. | ||
/// | ||
/// @example scss | ||
/// .govuk-component__link { | ||
/// @include govuk-link-common; | ||
/// @include govuk-link-style-no-visited-state; | ||
/// } | ||
/// | ||
/// @access public | ||
|
||
@mixin govuk-link-style-no-visited-state { | ||
&:link { | ||
color: $govuk-link-colour; | ||
} | ||
|
||
&:visited { | ||
color: $govuk-link-colour; | ||
} | ||
|
||
&:hover { | ||
color: $govuk-link-hover-colour; | ||
} | ||
|
||
&:active { | ||
color: $govuk-link-active-colour; | ||
} | ||
|
||
// When focussed, the text colour needs to be darker to ensure that colour | ||
// contrast is still acceptable | ||
&:focus { | ||
color: $govuk-focus-text-colour; | ||
} | ||
} | ||
|
||
/// Print friendly link mixin | ||
/// | ||
/// When printing, append the the destination URL to the link text, as long | ||
|
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.
👍