Skip to content

Conversation

@yotam-wix
Copy link
Collaborator

@yotam-wix yotam-wix commented Dec 10, 2025

Description

Added better hitslop calculation for buttons to handle edge cases i.e. link/icon buttons.
Added better hitslop calculation for slider thumb.
all touchable component should have a 48x48 hitslop now.

Changelog

Button and Slider Thumb Fixed hit target to be at least of 48x48.

Additional info

MADS-4840

@yotam-wix yotam-wix requested a review from lidord-wix December 10, 2025 15:38
@lidord-wix lidord-wix requested review from adids1221 and removed request for lidord-wix December 11, 2025 07:32
}

state: Record<'size', undefined | number> = {
state: ButtonState = {
Copy link
Contributor

Choose a reason for hiding this comment

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

You switched to using ButtonState type (which is great!), but measuredSize and borderRadius aren't initialized in the state object. They're set later in onLayout, but it's better to initialize them upfront for clarity.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

so should I just initialize them both to be undefined here?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's better for readability, WDYT ?


needsHitslopMeasurement() {
const {avoidMinWidth, avoidInnerPadding, round} = this.props;
return this.isLink || (this.isIconButton && !round) || avoidMinWidth || avoidInnerPadding;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why this (this.isIconButton && !round) checking is related here ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

for round buttons in general we have a separate measurement happening already in the code, and icon buttons have an issue where the button size depends on the icon size (there's a separate check in the code where if an icon button is non-round no padding is applied and no minWidth is set), so we have to measure its dimensions in this case.

Copy link
Contributor

@adids1221 adids1221 left a comment

Choose a reason for hiding this comment

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

Nice work, left few small comments.

@adids1221 adids1221 assigned yotam-wix and unassigned adids1221 Dec 11, 2025
@yotam-wix yotam-wix requested a review from adids1221 December 11, 2025 12:16
@yotam-wix
Copy link
Collaborator Author

#rebuild

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.

3 participants