-
Notifications
You must be signed in to change notification settings - Fork 735
feat(button & stepper): ensure minimum 48x48 hit target for better accessibility #3522
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
src/components/button/index.tsx
Outdated
const isWidthDefined = containerStyle.width !== undefined || containerStyle.minWidth !== undefined; | ||
const width = containerStyle.width || containerStyle.minWidth || 0; |
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.
Can't we combine both
I think isWidthDefined is redundant, you check run checks on the width (if it's zero it's undefined)
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.
Removed
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 found why I added this. There are times (when the button is round) when the width and height is undefined but there is padding this way the button is not just the padding because of the text inside of it and we will add extra hitslop for nothing. Instead of just the 10 we decided to add by default.
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.
Because the width will not be zero in this case (it will have the padding)
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.
@ethanshar ping
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.
As we've talked I'm reverting the changes I did so we make the isWidthDefined
check. I'll change it to isWidthSet
as well. I think its more readable. wdyt?
…ve hit slop logic
…nd improve hit slop logic" This reverts commit c1b3ba1.
Description
Added hit slop to the button component based on its size.
This pr fixes the stepper as well.
Changelog
Button - Fixed hit target to be at least of 48x48.
Stepper - Fixed hit target to be at least of 48x48.
Additional info
MADS-4591