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

Fix focus styles for links split over multiple lines in Chromium 108+ (Chrome 108+, Edge 108+, Opera 94+) #3087

Merged
merged 2 commits into from
Dec 9, 2022

Conversation

36degrees
Copy link
Contributor

@36degrees 36degrees commented Dec 9, 2022

Chromium 108 includes a change in behaviour for box decoration when a box is split over multiple lines, pages etc.

This change in theory brings Chromium in line with the CSS Fragmentation Module Level 3 spec but means that the box-shadow (which we rely on for colour contrast for the focus state) no longer appears on links that break over multiple lines.

This affects browsers based on Chromium 108 including Chrome 108, Edge 108 and Opera 94.

Add box-decoration-break: clone so that box-shadow is applied to each fragment independently, maintaining the existing behaviour in Chromium browsers.

Before

A link with long enough text that it wraps over two lines. The link is focused, and has a yellow background. It is missing a black bottom edge (box-shadow) which is present on single-line links.

After

A link with long enough text that it wraps over two lines. The link is focused, and has a yellow background, and has a black bottom edge (box-shadow) which matches the style used on single-line links.

Fixes #3085.

Chromium 108 includes a change in behaviour for box decoration when a box is split over multiple lines, pages etc [1].

This change in theory brings Chromium in line with the CSS Fragmentation Module Level 3 spec [2] but means that the box-shadow (which we rely on for colour contrast for the focus state) no longer appears on links that break over multiple lines.

This affects browsers based on Chromium 108 including Chrome 108, Edge 108 and Opera 94.

Add `box-decoration-break: clone` so that `box-shadow` is applied to each fragment independently, maintaining the existing behaviour in Chromium browsers.

[1]: https://bugs.chromium.org/p/chromium/issues/detail?id=682173
[2]: https://www.w3.org/TR/css-break-3/#propdef-box-decoration-break

Co-authored-by: Colin Rotherham <work@colinr.com>
Copy link
Contributor

@colinrotherham colinrotherham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brill, thanks for the co-author comment too 😊

I checked the autoprefixer output too (just in case) and all good

Do we normally do a changelog entry too or one for another PR?

@36degrees 36degrees changed the title Fix link focus styles in Chromium 108+ Fix link focus styles in Chromium 108+ (Chrome 108+, Edge 108+, Opera 94+) Dec 9, 2022
@36degrees 36degrees changed the title Fix link focus styles in Chromium 108+ (Chrome 108+, Edge 108+, Opera 94+) Fix focus styles for links split over multiple lines in Chromium 108+ (Chrome 108+, Edge 108+, Opera 94+) Dec 9, 2022
@36degrees 36degrees merged commit d92a05a into main Dec 9, 2022
@36degrees 36degrees deleted the focus-state-box-decoration-break branch December 9, 2022 11:53
@abbott567
Copy link

Wow, ridiculously quick turn around! Bravo!

@NickColley
Copy link
Contributor

Great work!

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.

Links fail colour contrast on focus if they wrap to a new line
4 participants