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

Warning text does not explicitly set font-weight #5279

Closed
matteason opened this issue Sep 1, 2024 · 1 comment · Fixed by #5331
Closed

Warning text does not explicitly set font-weight #5279

matteason opened this issue Sep 1, 2024 · 1 comment · Fixed by #5331
Labels
🐛 bug Something isn't working the way it should (including incorrect wording in documentation) small story warning text

Comments

@matteason
Copy link
Contributor

matteason commented Sep 1, 2024

The warning text component doesn't explicitly set a font weight, instead assuming that <strong> will always be bold because of browser default styles:

.govuk-warning-text__icon {
// We apply this here and not at the parent level because the actual text is
// a <strong> and so will always be bold
@include govuk-typography-weight-bold;

I think this was introduced in GOV.UK Frontend 5.0.0: 18caff5#diff-245553285fc1127f05c68705df40d7fdf95abebef3173eab71ea6b4d8bf89546

I think in almost all other places, Frontend is very careful to avoid relying on default styles. <strong> is a semantic element and the spec doesn't specify that user agents should render <strong> as bold, though it's a common convention.

I happened to run into this on a project using the Meyer reset, where the warning text was rendering as normal weight, but it may also affect similar reset/normalise stylesheets.

@matteason matteason added awaiting triage Needs triaging by team 🐛 bug Something isn't working the way it should (including incorrect wording in documentation) labels Sep 1, 2024
@romaricpascal romaricpascal added warning text small story and removed awaiting triage Needs triaging by team labels Sep 10, 2024
romaricpascal added a commit that referenced this issue Sep 17, 2024
There's no guarantee browser defaults of `bold` or `bolder` have not been overriden
so we need to set the font-weight explicitely.

Closes #5279
romaricpascal added a commit that referenced this issue Sep 17, 2024
There's no guarantee browser defaults of `bold` or `bolder` have not been overriden
so we need to set the font-weight explicitely.

Closes #5279
@romaricpascal
Copy link
Member

Hi @matteason, that's a good spot, we missed that subtlety at the time! I've opened a PR with a fix which hopefully will be able to ship with our next release.

patrickpatrickpatrick pushed a commit that referenced this issue Oct 7, 2024
There's no guarantee browser defaults of `bold` or `bolder` have not been overriden
so we need to set the font-weight explicitely.

Closes #5279
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working the way it should (including incorrect wording in documentation) small story warning text
Projects
Status: Needs review 🔍
Development

Successfully merging a pull request may close this issue.

2 participants