Skip to content
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

Fix z-index of inputs in Radios and Checkboxes component #4768

Merged
merged 4 commits into from
Feb 16, 2024

Conversation

romaricpascal
Copy link
Member

The z-index: 1 declaration laying out the input above their corresponding label had disappeared when we updated how the elements were laid out to Flexbox. This broke Selenium testing suites trying to click the input (now covered by its label).

This PR reinstates the declaration, and adds automated tests for both components to ensure the order in which the elements are overlaid is checked so we won't miss this in the future.

Closes #4762

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-4768 February 16, 2024 12:44 Inactive
Copy link

📋 Stats

File sizes

File Size
dist/govuk-frontend-development.min.css 112.47 KiB
dist/govuk-frontend-development.min.js 38.58 KiB
packages/govuk-frontend/dist/govuk/all.bundle.js 78.74 KiB
packages/govuk-frontend/dist/govuk/all.bundle.mjs 73.99 KiB
packages/govuk-frontend/dist/govuk/all.mjs 3.86 KiB
packages/govuk-frontend/dist/govuk/govuk-frontend-component.mjs 359 B
packages/govuk-frontend/dist/govuk/govuk-frontend.min.css 112.46 KiB
packages/govuk-frontend/dist/govuk/govuk-frontend.min.js 38.57 KiB
packages/govuk-frontend/dist/govuk/i18n.mjs 5.38 KiB

Modules

File Size
all.mjs 70.32 KiB
components/accordion/accordion.mjs 21.67 KiB
components/button/button.mjs 4.7 KiB
components/character-count/character-count.mjs 21.24 KiB
components/checkboxes/checkboxes.mjs 5.83 KiB
components/error-summary/error-summary.mjs 6.57 KiB
components/exit-this-page/exit-this-page.mjs 16.08 KiB
components/header/header.mjs 4.46 KiB
components/notification-banner/notification-banner.mjs 4.93 KiB
components/radios/radios.mjs 4.83 KiB
components/skip-link/skip-link.mjs 4.39 KiB
components/tabs/tabs.mjs 10.16 KiB

View stats and visualisations on the review app


Action run for 401dc2c

Copy link

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 081ea2694..7f08b23bf 100644
--- a/packages/govuk-frontend/dist/govuk/govuk-frontend.min.css
+++ b/packages/govuk-frontend/dist/govuk/govuk-frontend.min.css
@@ -2476,6 +2476,7 @@
 }
 
 .govuk-checkboxes__input {
+    z-index: 1;
     width: 44px;
     height: 44px;
     margin: 0;
@@ -4815,6 +4816,7 @@ only screen and (min-resolution:2dppx) {
 }
 
 .govuk-radios__input {
+    z-index: 1;
     width: 44px;
     height: 44px;
     margin: 0;

Action run for 401dc2c

Copy link

Other changes to npm package

diff --git a/packages/govuk-frontend/dist/govuk/components/checkboxes/_index.scss b/packages/govuk-frontend/dist/govuk/components/checkboxes/_index.scss
index 5b1223d69..eb2ce95b0 100644
--- a/packages/govuk-frontend/dist/govuk/components/checkboxes/_index.scss
+++ b/packages/govuk-frontend/dist/govuk/components/checkboxes/_index.scss
@@ -24,6 +24,9 @@
   }
 
   .govuk-checkboxes__input {
+    // Allow the input to sit above the label, enabling its proper detection
+    // when exploring by touch or using automation tools like Selenium
+    z-index: 1;
     width: $govuk-touch-target-size;
     height: $govuk-touch-target-size;
     margin: 0;
diff --git a/packages/govuk-frontend/dist/govuk/components/radios/_index.scss b/packages/govuk-frontend/dist/govuk/components/radios/_index.scss
index 804aeb214..edb04303b 100644
--- a/packages/govuk-frontend/dist/govuk/components/radios/_index.scss
+++ b/packages/govuk-frontend/dist/govuk/components/radios/_index.scss
@@ -26,6 +26,9 @@
   }
 
   .govuk-radios__input {
+    // Allow the input to sit above the label, enabling its proper detection
+    // when exploring by touch or using automation tools like Selenium
+    z-index: 1;
     width: $govuk-touch-target-size;
     height: $govuk-touch-target-size;
     margin: 0;

Action run for 401dc2c

Copy link
Contributor

@owenatgov owenatgov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brill!

@romaricpascal romaricpascal merged commit 56d40fa into main Feb 16, 2024
45 checks passed
@romaricpascal romaricpascal deleted the fix-radio-z-index branch February 16, 2024 12:54
@owenatgov owenatgov mentioned this pull request Feb 21, 2024
jsrobertson added a commit to ministryofjustice/hmpps-accredited-programmes-ui that referenced this pull request Feb 26, 2024
This was added in after a govuk-frontend upgrade. This has now been sorted in 5.2.0 (alphagov/govuk-frontend#4768) so have reverted.
jsrobertson added a commit to ministryofjustice/hmpps-accredited-programmes-ui that referenced this pull request Feb 26, 2024
This was added in after a govuk-frontend upgrade. This has now been sorted in 5.2.0 (alphagov/govuk-frontend#4768) so have reverted.
jsrobertson added a commit to ministryofjustice/hmpps-accredited-programmes-ui that referenced this pull request Feb 26, 2024
This was added in after a govuk-frontend upgrade. This has now been sorted in 5.2.0 (alphagov/govuk-frontend#4768) so have reverted.
markhobson added a commit to acteng/update-your-capital-schemes that referenced this pull request Mar 1, 2024
MartinJJones added a commit to alphagov/smart-answers that referenced this pull request Jun 28, 2024
Version 5.1.0 of govuk-frontend contains refactoring to the CSS for radio buttons and checkboxes, this change resulted in tests throwing an `ElementClickInterceptedError`.

This was logged as a GitHub issue in govuk-frontend
 - alphagov/govuk-frontend#4762

This issue was fixed in version 5.2.0 - alphagov/govuk-frontend#4768
MartinJJones added a commit to alphagov/smart-answers that referenced this pull request Jul 2, 2024
Version 5.1.0 of govuk-frontend contains refactoring to the CSS for radio buttons and checkboxes, this change resulted in tests throwing an `ElementClickInterceptedError`.

This was logged as a GitHub issue in govuk-frontend
 - alphagov/govuk-frontend#4762

This issue was fixed in version 5.2.0 - alphagov/govuk-frontend#4768
MartinJJones added a commit to alphagov/smart-answers that referenced this pull request Jul 5, 2024
Version 5.1.0 of govuk-frontend contains refactoring to the CSS for radio buttons and checkboxes, this change resulted in tests throwing an `ElementClickInterceptedError`.

This was logged as a GitHub issue in govuk-frontend
 - alphagov/govuk-frontend#4762

This issue was fixed in version 5.2.0 - alphagov/govuk-frontend#4768
MartinJJones added a commit to alphagov/smart-answers that referenced this pull request Jul 10, 2024
Version 5.1.0 of govuk-frontend contains refactoring to the CSS for radio buttons and checkboxes, this change resulted in tests throwing an `ElementClickInterceptedError`.

This was logged as a GitHub issue in govuk-frontend
 - alphagov/govuk-frontend#4762

This issue was fixed in version 5.2.0 - alphagov/govuk-frontend#4768
MartinJJones added a commit to alphagov/smart-answers that referenced this pull request Jul 12, 2024
Version 5.1.0 of govuk-frontend contains refactoring to the CSS for radio buttons and checkboxes, this change resulted in tests throwing an `ElementClickInterceptedError`.

This was logged as a GitHub issue in govuk-frontend
 - alphagov/govuk-frontend#4762

This issue was fixed in version 5.2.0 - alphagov/govuk-frontend#4768
andysellick pushed a commit to alphagov/smart-answers that referenced this pull request Jul 15, 2024
Version 5.1.0 of govuk-frontend contains refactoring to the CSS for radio buttons and checkboxes, this change resulted in tests throwing an `ElementClickInterceptedError`.

This was logged as a GitHub issue in govuk-frontend
 - alphagov/govuk-frontend#4762

This issue was fixed in version 5.2.0 - alphagov/govuk-frontend#4768
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.

ElementClickInterceptedError using Selenium in 5.1.0
3 participants