alphagov / govuk-frontend

GOV.UK Frontend contains the code you need to start building a user interface for government platforms and services.
https://frontend.design-system.service.gov.uk/
MIT License
1.18k stars 325 forks source link

Long, unbroken link text (such as email addresses) can break out of page container #2233

Closed abbott567 closed 3 months ago

abbott567 commented 3 years ago

Summary

The standard wrapping on body content can create a scenario where long email addresses can cause a service to fail WCAG 2.1 - 1.4.10 Reflow.

Reflow states that content must not force horizontal scrolling in a viewport of 320px wide unless it's a map, a table, a game or something else where it is necessary. For regular content it needs to reflow and maintain vertical scrolling only.

If you provide an email address which does not contain regular breaking characters such as hyphens, then the email address refuses to break and forces the viewport to horizontal scroll.

By adding the CSS property: overflow-wrap:anywhere the issue is resolved.

Steps to reproduce the issue

  1. Add a long email address to some body content which does not contain any standard breaking characters. For example:

    <a href="#" class="govuk-link">
    anExampleOfAReallyLongEmailAddress@WhichPushesTheContentOver320PixelsWide.com
    </a>
  2. Reduce the viewport width to 320px wide and observe horizontal scrolling.

image

Environment (where applicable)

abbott567 commented 3 years ago

Worth pointing out the service this was observed on was a staff facing system, so the email address was probably longer than usual. It was chaining together team names and business areas using full stops. For example: `jonathan.macfarland@orangeteam.improvementprojects.department.gov.uk

36degrees commented 3 years ago

I'm not sure there's an easy generic fix for this. Adding overflow-wrap:anywhere to the body (or applying it generally to paragraphs, links etc) causes issues wherever we're relying on intrinsic sizing for layout, for example in tables or the phase banner.

Screenshot 2021-06-03 at 15 05 12 Screenshot 2021-06-03 at 15 06 40

I think this is something that would need to be handled on a case by case basis, like we have for summary list.

abbott567 commented 3 years ago

Yeah, I guess even if it was available as a class so you could override it manually. Possibly like .govuk-!-force-wrap or something.

github-actions[bot] commented 5 months ago

Uh oh! @abbott567, the image you shared is missing helpful alt text. Check your issue body.

Alt text is an invisible description that helps screen readers describe images to blind or low-vision users. If you are using markdown to display images, add your alt text inside the brackets of the markdown image.

Learn more about alt text at Basic writing and formatting syntax: images on GitHub Docs.

🤖 Beep boop! This comment was added automatically by github/accessibility-alt-text-bot.