Skip to content

Commit 23c6309

Browse files
author
Vanita Barrett
authored
Merge pull request #2366 from alphagov/fix-panel-overflow
Fix panel text overflowing when zoomed in on mobile
2 parents d8a651d + 7033813 commit 23c6309

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ You can now use the `govuk-!-text-align-left`, `govuk-!-text-align-centre` and `
1010

1111
This was added in [pull request #2368: Add text align override classes](https://github.com/alphagov/govuk-frontend/pull/2368).
1212

13+
### Fixes
14+
15+
- [#2366: Fix panel text overflowing when zoomed in on mobile #2366](https://github.com/alphagov/govuk-frontend/pull/2366)
1316

1417
## 3.13.1 (Fix release)
1518

app/views/full-page-examples/passport-details/confirm.njk

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22

33
{% from "panel/macro.njk" import govukPanel %}
44

5-
{% set pageTitle = "Passport details submitted" %}
5+
{% set pageTitle = "We have emailed you a confirmation" %}
66
{% block pageTitle %}{{ pageTitle }} - GOV.UK{% endblock %}
77

88
{% block content %}
99
<div class="govuk-grid-row">
1010
<div class="govuk-grid-column-two-thirds">
1111
{{ govukPanel({
12-
titleText: pageTitle
12+
titleText: pageTitle,
13+
html: "Your reference number<br><strong>HDJ2123F</strong>"
1314
}) }}
1415
</div>
1516
</div>

src/govuk/components/panel/_index.scss

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,19 @@
1212
text-align: center;
1313

1414
@include govuk-media-query($until: tablet) {
15-
padding: govuk-spacing(6) - $govuk-border-width;
15+
padding: govuk-spacing(3) - $govuk-border-width;
16+
17+
// This is an if-all-else-fails attempt to stop long words from overflowing the container
18+
// on very narrow viewports by forcing them to break and wrap instead. This
19+
// overflowing is more likely to happen when user increases text size on a mobile eg. using
20+
// iOS Safari text resize controls.
21+
//
22+
// The overflowing is a particular problem with the panel component since it uses white
23+
// text: when the text overflows the container, it is invisible on the white (page)
24+
// background. When the text in our other components overflow, the user might have to scroll
25+
// horizontally to view it but the the text remains legible.
26+
overflow-wrap: break-word;
27+
word-wrap: break-word; // Support IE (autoprefixer doesn't add this as it's not a prefix)
1628
}
1729
}
1830

0 commit comments

Comments
 (0)