-
Notifications
You must be signed in to change notification settings - Fork 1.3k
(RSP-1530) Adjust checkbox max width to prevent overflow scrolling in Form #249
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
Conversation
min-block-size: var(--spectrum-checkbox-height); | ||
max-inline-size: 100%; | ||
/* Accommodates for right padding in case width: 100% is applied to the Checkbox directly. */ | ||
max-inline-size: calc(100% - var(--spectrum-checkbox-cursor-hit-x) * 2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
???????????? Still digging to find out why this helps. At first I thought it was that the hit area was exceeding the container width and thus causing overflow to kick in but it doesn't truly seem to be the case.
Fix works tho
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wha? but that element is absolutely positioned, it shouldn't affect the size at all
I do believe you that this works
did you try small sizes though? it may still fall apart there or the box size may looks funny for very wide cases (not that it would be bad in the wide case)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, its not the hit area, it is actually just the checkbox's margin-inline-end
padding that causes the checkbox to exceed the container width when width: 100%
is applied directly to the Checkbox. I tried doing box-sizing: border-box;
as was suggested in some posts I read but no dice. I figured the above change was preferable to removing the margin-inline-end
padding since I felt people were more likely to put things next to checkboxes and since the above change just shortens the hit box a little bit
At small sizes the shortened checkbox is more noticeable for sure, but not horribly so IMO, especially at those widths you are dealing with single letter labels (which are still clickable actually):
Uncaptured in the screenshot is my mouse hovering over the right edge of the "C" and it still changing into the hand(?) cursor that indicates a button/clickable element of some sort
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer having the box-sizing: border-box
approach but can't for the life of me figure out why it isn't working
Build successful! 🎉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Build successful! 🎉 |
Build successful! 🎉 |
Build successful! 🎉 |
Build successful! 🎉 |
Build successful! 🎉 |
Build successful! 🎉 |
We will need to retest Checkboxes with this change |
Closes https://jira.corp.adobe.com/browse/RSP-1530
Still not 100% why the heck this happens but I've adjusted the max width to accommodate for the checkbox's right padding and the scrolling issue is now gone.
✅ Pull Request Checklist:
📝 Test Instructions:
Go to "dialog: form" story and make sure there isn't horizontal scrolling happening on medium or large scale. For a base reproduction of the old issue, reset the css changes here and go to the Checkbox story and change the render to look like this: