Skip to content

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

Merged
merged 8 commits into from
Feb 27, 2025
Original file line number Diff line number Diff line change
Expand Up @@ -3555,6 +3555,14 @@ exports[`TextField Screen renders screen 1`] = `
accessible={true}
collapsable={false}
focusable={true}
hitSlop={
{
"bottom": 15,
"left": 0,
"right": 0,
"top": 15,
}
}
onClick={[Function]}
onLayout={[Function]}
onResponderGrant={[Function]}
Expand Down Expand Up @@ -3891,10 +3899,10 @@ exports[`TextField Screen renders screen 1`] = `
focusable={true}
hitSlop={
{
"bottom": 20,
"left": 20,
"right": 20,
"top": 20,
"bottom": 7.5,
"left": 10,
"right": 10,
"top": 7.5,
}
}
onClick={[Function]}
Expand Down Expand Up @@ -4613,6 +4621,14 @@ exports[`TextField Screen renders screen 1`] = `
accessible={true}
collapsable={false}
focusable={true}
hitSlop={
{
"bottom": 7.5,
"left": 10,
"right": 10,
"top": 7.5,
}
}
onClick={[Function]}
onLayout={[Function]}
onResponderGrant={[Function]}
Expand Down
7 changes: 7 additions & 0 deletions src/components/button/ButtonConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,11 @@ export const MIN_WIDTH = {
LARGE: 90
};

export const SIZE_TO_VERTICAL_HITSLOP = {
[ButtonSize.xSmall]: 30,
[ButtonSize.small]: 25,
[ButtonSize.medium]: 20,
[ButtonSize.large]: 15
} as const;

export const DEFAULT_SIZE = ButtonSize.large;
Loading