-
Notifications
You must be signed in to change notification settings - Fork 232
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
Add guidance for break-word override class #3968
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
✅ You can preview this change here:
To edit notification comments on pull requests, go to your Netlify site configuration. |
querkmachine
changed the title
Add draft guidance for break-word override class
[DO NOT MERGE] Add draft guidance for break-word override class
Aug 1, 2024
seaemsi
reviewed
Aug 1, 2024
seaemsi
reviewed
Aug 1, 2024
seaemsi
requested changes
Aug 1, 2024
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! I've suggested some style changes for readability
querkmachine
force-pushed
the
break-word-override-guidance
branch
from
August 1, 2024 14:38
51cd3f2
to
3cd2922
Compare
querkmachine
force-pushed
the
break-word-override-guidance
branch
2 times, most recently
from
August 2, 2024 09:23
d715ef7
to
fde810d
Compare
querkmachine
force-pushed
the
break-word-override-guidance
branch
from
August 2, 2024 12:19
fde810d
to
3ab1e22
Compare
calvin-lau-sig7
approved these changes
Aug 2, 2024
seaemsi
approved these changes
Aug 6, 2024
Co-authored-by: seaemsi <50173207+seaemsi@users.noreply.github.com> Co-authored-by: Calvin Lau <77630796+calvin-lau-sig7@users.noreply.github.com>
querkmachine
force-pushed
the
break-word-override-guidance
branch
from
August 9, 2024 09:04
3ab1e22
to
3f941ab
Compare
querkmachine
changed the title
[DO NOT MERGE] Add draft guidance for break-word override class
Add draft guidance for break-word override class
Aug 9, 2024
querkmachine
changed the title
Add draft guidance for break-word override class
Add guidance for break-word override class
Aug 9, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
We added a new typography override class (
govuk-!-text-break-word
) into govuk-frontend that breaks long words across multiple lines if the word would otherwise not fit into its parent container. alphagov/govuk-frontend#5159The most common example of this is probably long email addresses on narrow viewports, but it may also be an issue for the text in data tables, technical and scientific terms, or when localising content into languages with long compound words such as German.
This is a first pass at some guidance about the override class.
Quick link to the draft guidance.
Warning
This should not be merged until a version of GOV.UK Frontend featuring the override class has been released.
Note
The code example included won't appear correctly until after a new release of Frontend is made and merged with the Design System website.
Changes
wbr
HTML tag.Thoughts
Inclusion of
wbr
guidanceI've included a paragraph and an example that shows the class being used in conjunction with the
wbr
HTML element. This element indicates where it is 'safe' to break a long word across multiple lines.Using
wbr
isn't required to use the class at all, but it's a useful companion to what problems the class is intended to solve. It's a somewhat obscure element, so calling it out here specifically seemed like it might be useful.Visual explainer of what
wbr
actually doesTo illustrate what it does visually, given this HTML:
Without
wbr
, the email address could be wrapped at any point, leading to potentially confusing (or rude) 'partial' sentences in narrow content containers.By adding
wbr
s into the HTML content, we can define where to prioritise line breaks should one need to occur:This basically creates a list of 'segments' that we don't want line breaks to appear within:
(Note that there is still potential for line breaks to appear within a segment, but this will now only happen if the individual segment is itself too long for the containing element.)
At similar container widths to the above, you'll now end up with something like:
Given it isn't directly related to the override class, I'm not sure if including this is extraneous or has the potential to confuse or mislead. It would be simpler to omit it, but it also feels like it could be helpful for a subset of users.