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
Very long words overflow from containers #366
Comments
The issue here is that adding overflow-wrap: break-work or simmilar results in long links breaking in the middle of words even when there are spaces, leading to tickets being raised like
The compromise at BHCC was to do this on email addresses only, and only on small screens: /* Allow long link titles to wrap on small screens. */
.rich-text__item a[href^="mailto:"] {
display: inline-block;
word-break: break-all;
}
/* Reset to default behaviour for larger screens */
@media only screen and (min-width: 768px) {
.rich-text__item a[href^="mailto:"] {
display: inline;
word-break: normal;
}
} Beyond this, we would need javascript to add some invisible breaking spaces or wrap long words in classes to apply the break word behaviour. |
We could always wrap a |
Isn't the point of
|
Thanks @keelanfh I'll have to check up on that, it was when we had really long links, but the links had spaces in them, that they still broke anywhere. I'll have a review of your suggestion of using overflow-wrap instead, might save us on adding a Javascript hack. |
I found out the reason overflow: break-word does not work for BHCC is the presence of the hyphen in the brighton and hove email addresses eg. reallylongemailaddressthatforcescontenttoextendofthescreen@brighton-hove.gov.uk forces the break to happen at the hypen. However the above fix should be good as a general fix for everyone else. |
overflow-wrap: anywhere seems to actully work better though, and still breaks at spaces for non long links, so maybe that one is better? |
Interesting, I suppose the question is whether this is bad? I can see arguments for it being logical to do this if there needs to be a space, but I suppose it would be annoying in the case that the whole email address could fit if put on a new line. There are other councils with hyphens in email addresses too.
my concern with this - based on the diagram on MDN - is that it will force breaks in cases where the container doesn't have a fixed width. I can't think of an example of this in LGD immediately - most of the container widths are set in relation to their parents - but it's possible that there are some. |
Very long words overflow from their containers - spotted on Guide Overview pages. This is a very unrealistic scenario but I think there's nothing to lose by adding
overflow-wrap: break-word
somewhere. There might be other places where this is more likely to happen, with narrower elements?The text was updated successfully, but these errors were encountered: