Skip to content

Fix padded checkboxes: anchor border/tick to the input element. - #2300

Merged
dsagal merged 1 commit into
mainfrom
checkbox-position-relative
Apr 27, 2026
Merged

Fix padded checkboxes: anchor border/tick to the input element.#2300
dsagal merged 1 commit into
mainfrom
checkbox-position-relative

Conversation

@dsagal

@dsagal dsagal commented Apr 25, 2026

Copy link
Copy Markdown
Member

Small CSS fix in the checkbox component: the border and tick are now positioned relative to the input itself rather than an outer ancestor. Also remove two callers' workarounds for the same issue.

Adds a Storybook example for checkboxes inside a padded wrapper, the case where the misalignment was visible.

Context

If a component like labeledSquareCheckbox is styled to include padding, its rendering has been broken: the tick is misplaced. This PR fixes it.

Proposed solution

Adds position: relative to the checkbox input element.

Has this been tested?

No automated test for this css-only change, but a storybook example is added, which looks wrong without the change, and is fixed by it.

  • 👍 yes, I added tests to the test suite
  • 💭 no, because this PR is a draft and still needs work
  • 🙅 no, because this is not relevant here
  • 🙋 no, because I need help

Screenshots / Screencasts

Storybook example before the fix (note the radio workaround that's corrects it):
image

Storybook with the fix (the radio workaround removed, but is still correct):
image

Small CSS fix in the checkbox component: the border and tick are now
positioned relative to the input itself rather than an outer ancestor.
Also remove two callers' workarounds for the same issue.

Adds a Storybook example for checkboxes inside a padded wrapper, the
case where the misalignment was visible.
@dsagal
dsagal merged commit 569dc49 into main Apr 27, 2026
38 of 41 checks passed
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.

2 participants