-
Notifications
You must be signed in to change notification settings - Fork 324
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
Update error messages to use paragraph tags instead of spans #2452
Conversation
Closes #2083 Updates the error messages parent element to use paragraph tags instead of spans, as it's more semantically correct.
4feca6d
to
555d3e0
Compare
Yep, good catch. I think there's an additional top margin coming from the user agent default styles for paragraphs? |
Switching the error message to a paragraph means that it gets any default browser styles for paragraphs applied. Looking at https://browserdefaultstyles.com/#p this seems to be margin-top and margin-bottom. We already set margin-bottom on the error message. This commit makes sure we set `margin-top` to `0` to reset any browser styles.
I've done a visual inspection in:
|
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 good to me
As a note, @lfdebrux has also spotted that this slightly changes how this component looks when styles are disabled. As it's now a paragraph, the error message renders on its own line, but we think this is an improvement. BeforeAfter |
Previously they were in spans but in version 4.0.0 of the design system p is preferred because it's more semantically correct alphagov/govuk-frontend#2452
Part of #2083
Updates the error messages parent element to use paragraph tags instead of spans, as it's more semantically correct.
Read #2083 (comment) for full details of accessibility testing. There should be no visual difference following this change.