Add a space before homepage heading dash #3841
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
We recently swapped the punctuation in the visually hidden text in the new homepage heading from a colon to a dash, but didn't include a space in front of the dash. This wasn't obvious visually or when tested with screen readers since the visually hidden text inserts a space character before it. However if the user turns off their stylesheets, there wouldn't be a space character before the dash and this is the version that search engines receive as well.
(This also makes https://trello.com/c/kroI3kLZ/684-stop-extra-whitespace-being-added-inside-homepage-h1 redundant although as noted on that ticket, we might need to look into being able to control whitespace in templates in the future if another use case for needing this comes up. )
Why
So that search engines and users who turn off stylesheets get the space before the dash.
Screenshots?
Before (when stylesheets are turned off)
After (when stylesheets are turned off)
Tested in
I did some testing with screen readers to check that they aren't now announcing two spaces since the visually hidden text contains a space too. (Although I had actually already tested in alphagov/govuk-frontend#3836 that the space before visually hidden text doesn't result in double spaces when there's text before the visually hidden text so my testing for this PR was just a quick check to confirm that).
JAWS 2023 with Chrome
NVDA 2023 with Chrome