nhsuk-frontend icon indicating copy to clipboard operation
nhsuk-frontend copied to clipboard

Ticks on checkboxes inside details element not rendering correctly

Open andymantell opened this issue 1 year ago • 1 comments

Bug Report

What is the issue?

If you put a checkbox inside a details element, the tick is too large and not centred correctly.

image

What steps are required to reproduce the issue?

Combine the details and checkbox examples from the design system as per this codepen:

https://codepen.io/andymantell/pen/KKYdjxE

What was the environment where this issue occurred?

  • Device: Windows PC
  • Operating System: Windows 11
  • Browser: Google Chrome
  • Browser version: 122
  • NHS.UK frontend package version: 8.1.0

andymantell avatar Mar 07 '24 12:03 andymantell

Thanks to @Fenwick17 - we've worked out that adding this CSS fixes the issue:

.nhsuk-label {
  box-sizing: border-box;
}

It's slightly baffling me why the label is inheriting a box-sizing differently inside the details element... But this fix does seem to work, and it's pretty harmless since border-box is what we'd want it to be anyway. I've stuck it in our service's "shame.scss" for the moment - will do a PR once we've been through testing.

andymantell avatar Mar 14 '24 10:03 andymantell

This was closed by https://github.com/nhsuk/nhsuk-frontend/pull/1449

colinrotherham avatar Aug 15 '25 13:08 colinrotherham