Skip to content

Conversation

@querkmachine
Copy link
Member

@querkmachine querkmachine commented Nov 21, 2025

Due to an upstream issue in Safari on iOS 18 (and potentially iOS 17), the box model calculations for children of the Date input component go a bit wrong when an input's value is deleted and re-typed.

The issue was reported to the WebKit team during the beta period of iOS 26 and fixed before the final release of iOS 26 in September, however no fix for older versions of iOS has yet happened nor appears to be coming, so we should prevent the issue in our own code until iOS 18 has fallen out of browsers we support.

The specific fix is the one suggested by @colinrotherham in the NHS.UK Frontend issue: nhsuk/nhsuk-frontend#1227 (comment)

Closes #5861.

Changes

  • Added vertical-align rule to items within the Date input component.

@querkmachine querkmachine self-assigned this Nov 21, 2025
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-6454 November 21, 2025 14:26 Inactive
@github-actions
Copy link

github-actions bot commented Nov 21, 2025

Stylesheets changes to npm package

diff --git a/packages/govuk-frontend/dist/govuk/govuk-frontend.min.css b/packages/govuk-frontend/dist/govuk/govuk-frontend.min.css
index 741b02be4..2f6332e72 100644
--- a/packages/govuk-frontend/dist/govuk/govuk-frontend.min.css
+++ b/packages/govuk-frontend/dist/govuk/govuk-frontend.min.css
@@ -2700,7 +2700,8 @@ screen and (forced-colors:active) {
 .govuk-date-input__item {
     display: inline-block;
     margin-right: 20px;
-    margin-bottom: 0
+    margin-bottom: 0;
+    vertical-align: bottom
 }
 
 .govuk-date-input__label {

Action run for 84cc312

@github-actions
Copy link

github-actions bot commented Nov 21, 2025

Other changes to npm package

diff --git a/packages/govuk-frontend/dist/govuk/components/date-input/_index.scss b/packages/govuk-frontend/dist/govuk/components/date-input/_index.scss
index 43d1bc7c6..38c670858 100644
--- a/packages/govuk-frontend/dist/govuk/components/date-input/_index.scss
+++ b/packages/govuk-frontend/dist/govuk/components/date-input/_index.scss
@@ -14,6 +14,11 @@
     display: inline-block;
     margin-right: govuk-spacing(4);
     margin-bottom: 0;
+
+    // Prevents an issue in iOS Safari 18 where the items vertically
+    // shift when the value of inputs is changed.
+    // https://github.com/alphagov/reported-bugs/issues/90
+    vertical-align: bottom;
   }
 
   .govuk-date-input__label {

Action run for 84cc312

@querkmachine querkmachine force-pushed the fix-date-input-alignment-ios18 branch from 364422e to 9cf64ea Compare November 21, 2025 14:28
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-6454 November 21, 2025 14:28 Inactive
@querkmachine querkmachine requested a review from a team November 21, 2025 14:28
@querkmachine querkmachine changed the title Prevent date inputs shifting alignment on iPadOS 18 Prevent date inputs shifting alignment on iOS 18 Nov 21, 2025
@querkmachine querkmachine force-pushed the fix-date-input-alignment-ios18 branch from 9cf64ea to ae1071d Compare November 21, 2025 14:31
@github-actions
Copy link

github-actions bot commented Nov 21, 2025

📋 Stats

No changes to any distributed file sizes!


Action run for 84cc312

@colinrotherham
Copy link
Contributor

Thanks @querkmachine I've snagged this (co-author credit) for NHS.UK frontend too

Much appreciated

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-6454 November 21, 2025 14:46 Inactive
@querkmachine
Copy link
Member Author

querkmachine commented Nov 21, 2025

Not sure why the Heroku deployment is failing. Investigating...

Edit: Info here - #6455

Due to an upstream issue in Safari on iOS 18 (and potentially 17), the box model calculations for these inputs go iffy when the value is deleted and re-typed.

The upstream issue was reported during the beta period of iOS 26 and fixed in the release of iOS 26 in September, however no fix for older versions seems to be coming, so we should prevent the issue in our own code in the meantime.

NHS.UK Frontend issue: nhsuk/nhsuk-frontend#1227
Our bug report: alphagov/reported-bugs#90
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Date Input layout shift on iPad

4 participants