Skip to content

fix!: expand interactive targets to the 48dp minimum - #5108

Merged
Doberjohn merged 16 commits into
callstack:mainfrom
k0ndee:@k0ndee/48dp-touch-targets
Nov 13, 2026
Merged

Doberjohn merged 16 commits into
callstack:mainfrom
k0ndee:@k0ndee/48dp-touch-targets

Conversation

@k0ndee

@k0ndee k0ndee commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

MD3 requires 48dp touch targets without resizing what is drawn. Each interactive component now computes its own hitSlop with getMinInteractiveSizeHitSlop, and TouchableRipple only applies it. This covers IconButton, TextInput.Icon, Chip (the close button fills its 34dp column, 48dp tall) and SegmentedButtons. On web, where react-native-web dropped hitSlop, TouchableRipple renders an aria-hidden target instead.

Checkbox, Switch and RadioButton are resized in #5104, #5102 and #5007, Button in #5097.

Part of #5079.

Test plan

Typecheck, lint and tests pass. Tapped inside and past the slop on iOS 26.5, Android and web: all targets reach 48dp, a caller hitSlop wins, and disabled components get none.

BREAKING CHANGE: On web borderless no longer clips children, IconButton feedback ignores corner radii in style, and taps in a Chip's close column call onClose instead of onPress.

@k0ndee
k0ndee force-pushed the @k0ndee/48dp-touch-targets branch from ad60f24 to f7b7f18 Compare September 8, 2026 08:24

@satya164 satya164 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copied from my review on #5080. The layout-measurement feedback below has already been addressed in this PR. The remaining inline comments are copied unchanged.

Remove LLM generated comments. Only add comments where the code maybe unclear and it's necessary.

The touchable should not enforce a minimum hitSlop. Adding unnecessary onLayout everywhere has performance overhead. It should only accept hitSlop prop without layout measurement or minimums. The web version only needs to implement hitSlop since React Native Web doesn't support it.

The actual hitSlop should be passed by components where they are needed, e.g. checkbox. It's simpler and doesn't have require layout measurements.

The following original Chip comment is also already addressed here, since the constants now precede the component JSDoc:

These constants are added between the component and its JSDoc, which will break documentation generation for the component.

Comment thread src/theme/tokens/sys/state.ts Resolved
Comment thread src/theme/tokens/sys/state.ts Resolved
Comment thread src/components/Checkbox/Checkbox.tsx Resolved
Comment thread src/components/Checkbox/Checkbox.tsx Resolved
Comment thread src/components/Chip/Chip.tsx Resolved
@k0ndee
k0ndee force-pushed the @k0ndee/48dp-touch-targets branch from 271d56a to 8910723 Compare September 10, 2026 10:41
@satya164
satya164 requested a balanced review from Copilot September 15, 2026 20:32

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

lukemorawski and others added 9 commits September 16, 2026 10:28
The component doc comment ended up separated from `const Chip =` by the
hitSlop helper constants, so the docs generator could no longer find it.
main removed the hardcoded default testIDs from Chip and IconButton
(callstack#5088). Guard Chip's close-icon testID the same way its container
already is, and pass explicit testID props in the hitSlop/close-icon
tests that relied on the old defaults.
@k0ndee
k0ndee force-pushed the @k0ndee/48dp-touch-targets branch from c53d39b to d3671d7 Compare September 16, 2026 08:32
@JKobrynski

Copy link
Copy Markdown
Collaborator

We've decided Checkbox, Switch and RadioButton should just be 48dp instead of getting an invisible tap area. Could you drop the hit-slop from Checkbox and Switch, keeping Checkbox's borderRadius? The RadioButton changes can go, since #5007 rewrites those files. Sorry for the turnaround.

@k0ndee

k0ndee commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

We've decided Checkbox, Switch and RadioButton should just be 48dp instead of getting an invisible tap area. Could you drop the hit-slop from Checkbox and Switch, keeping Checkbox's borderRadius? The RadioButton changes can go, since #5007 rewrites those files. Sorry for the turnaround.

@JKobrynski I pushed a commit to address that:

  • removed hit-slop from Checkbox and Switch
  • kept Checkbox's borderRadius
  • reverted the RadioButton changes

One thing I'd like to clarify: with the hit-slop gone, Checkbox's touch target is now just 40x40 layout, so it's smaller than 48dp. Switch and RadioButton are also at their current sizes. Should I make them 48dp in this PR or will that be handled in other PRs, like #5007 for RadioButton?

@satya164

satya164 commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Review by Claude

iOS

1. Icon Button with corners set through style gets a round press highlight

Steps: open Icon Button, go to Custom, press and hold the square "eye" button (style={styles.square}) or the outlined heart (style={styles.differentBorderRadius}).

What happens: the press highlight is a 40dp circle inside the square or custom-shaped button.

What should happen: the highlight takes the button's visible shape, as it did on main where the container clipped it.

iOS: round highlight inside square and custom-radius IconButtons

(via Claude, verify if it makes sense)

2. width and height on IconButton break the layout

Steps: in IconButtonExample.tsx, add <IconButton icon="camera" mode="outlined" width={20} height={20} onPress={() => {}} /> (local edit only), then press and hold it.

What happens: the touchable is 20dp wide and pinned to the left edge of the 40dp button, and it stays full height because styles.touchable has flexGrow: 1. The icon is cut off. The hit slop is computed for 20x20, so it adds 14dp above and below a touchable that is already about 38dp tall.

What should happen: the button content stays centered and the slop matches the rendered size.

iOS: IconButton with width and height 20, highlight pinned left and icon clipped

(via Claude, verify if it makes sense)

Web

3. Same IconButton shape problem on hover

Steps: open Icon Button, go to Custom, hover the square "eye" button.

What happens: the hover fill is a circle inside the square button.

What should happen: the hover fill matches the button shape.

Web: round hover fill inside the square IconButton

(via Claude, verify if it makes sense)

@satya164 satya164 left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review by Claude

The PR description no longer matches the code after the last commit. It still describes hit slop on Checkbox, RadioButton and Switch, the RadioButton tokens file, the Switch web target and the Checkbox and RadioButton rows in the test table. Please update it so the squash message is right. (via Claude, verify if it makes sense)

Comment thread docs/6.x/docs/guides/migration.md Resolved
Comment thread docs/6.x/docs/guides/migration.md Resolved
Comment thread src/components/Chip/Chip.tsx Resolved
@satya164

Copy link
Copy Markdown
Contributor

Review by Claude

Web

1. Chip close button focus ring covers the end of the label

Steps: open Chip, press Tab until the close button of the "Close button" chip has focus.

What happens: the browser draws the focus ring around the whole 34x32 close column. The ring cuts through the last letter of the label and goes past the top, bottom and right edges of the chip.

What should happen: the ring stays around the close icon, inside the chip, as on main.

Web: Chip close button focus ring on main and on this PR

(via Claude, verify if it makes sense)

2. Chip close icon touches the label in RTL

Steps: turn on RTL in the drawer, open Chip and look at a chip with a close button.

What happens: the close icon sits at the left edge of its column, right next to the label, and leaves 16dp of empty space on its right.

What should happen: the icon sits 8dp from the edge of the chip, as on main.

Web, RTL: Chip close icon position on main and on this PR

(via Claude, verify if it makes sense)

@satya164 satya164 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review by Claude

See the inline comments. (via Claude, verify if it makes sense)

Comment thread src/components/Chip/Chip.tsx Resolved
Comment thread src/components/Chip/Chip.tsx Resolved
@k0ndee k0ndee changed the title fix: expand interactive targets to the 48dp minimum fix!: expand interactive targets to the 48dp minimum Nov 6, 2026
@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Found potential problems with the pull request:

  • Screenshot or video evidence is missing. Make sure to include one if it affects the UI.

@Doberjohn Doberjohn added the needs pickup Work that has been started but needs someone to pick it up and continue. label Nov 6, 2026
@k0ndee

k0ndee commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review! All 7 points are addressed in the latest commit, along with satya's inline threads. I re-checked the targets on iOS, Android and web.

On the Chip model: #5081 is a draft that was waiting for this PR and #5107 (focus indicators), which is why they diverged. I'd keep this PR's 34dp column with vertical slop: it's space the chip already reserves, so the close target never overlaps the label or the chip body. A 24dp area with slop on all sides would overlap the label, and onPress and onClose would compete for that strip. I'll align #5081 after this merges, unless you prefer the 24dp model.

One open point: on Android with a hardware keyboard, focusing the close button shows the default grey highlight over the whole trailing column (on main it covered only the icon box). Should I handle it here or in the Chip MD3 work?

@Doberjohn Doberjohn removed the needs pickup Work that has been started but needs someone to pick it up and continue. label Nov 6, 2026
@Doberjohn

Copy link
Copy Markdown
Collaborator

Thanks for working through the whole review @k0ndee! @xdimota7x has taken #5108 from here with the rebase on main and the last review pass.

  • Chip close target: let's keep this PR's 34dp column with vertical slop. You are right that the close target never overlaps the label or the chip body. The Chip rewrite (feat: implement Chip component #5081) will follow this model.
  • The Android hardware keyboard focus highlight over the trailing column: let's leave it out of this PR and handle it in the Chip MD3 work, which replaces the close button's feedback anyway.

@xdimota7x

Copy link
Copy Markdown
Collaborator

Thanks for the update!
Everything from previous reviews has been addressed. I built the example app for web and measured the tap targets in the browser against main:

  • IconButton: 40 → 48
  • Chip close: 26×18 → 34×48
  • Chip body: 32 → 48 tall
  • SegmentedButtons: 48–50 tall
  • Disabled controls still get no slop

Currently, the only blocker is the conflict in Checkbox.tsx.

xdimota7x and others added 2 commits November 10, 2026 14:25
…ng main

The merge with main left the hitSlop describe unclosed, so main's
describe.each block ended up inside the last hitSlop test and the
file no longer parsed.

@Doberjohn Doberjohn left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

went through the seven points of my last review and the open threads against 296ac11, and they're all addressed. The merge with main kept #5104's Checkbox, #5097's Button and #5046's TouchableRipple changes intact, and typecheck, lint, tests and the build pass on the head and on the head merged with current main.

One blocker, the Chip minHeight (inline), and a few smaller fixes inline.

One more on web, outside the diff: BottomNavigation's tabs render TouchableRipple with borderless, and that was the only clip on the label's path. A label wider than its tab (five tabs on a narrow screen) now spills into the neighbouring tabs, where main cuts it at the tab edge. The bar passes no hitSlop, so overflow: 'hidden' on the tab item on web would bring the clip back.

Comment thread src/components/Chip/Chip.tsx Resolved
Comment thread src/components/Chip/Chip.tsx Resolved
Comment thread docs/6.x/docs/guides/migration.md Resolved
@Doberjohn
Doberjohn dismissed satya164’s stale review November 10, 2026 20:50

The points in this review are addressed in later commits or no longer apply after the rework; see the latest review.

@Doberjohn Doberjohn modified the milestones: 6.0.0, 6.0.0-beta.0 Nov 12, 2026
- Chip: drop the body minHeight so textStyle-sized chips keep their size,
  and give the body slop only when the chip has a touch handler.
- IconButton, TextInput.Icon: a forwarded `hitSlop={undefined}` keeps the
  48dp default.
- BottomNavigation: clip tab items on web, where `borderless` no longer
  clips a label wider than its tab.
- Docs: scope the `borderless` note to web and note that `hitSlop` now
  works on web.
@xdimota7x

Copy link
Copy Markdown
Collaborator

Thanks for the review @Doberjohn! I pushed 3d08150 to address it:

  • Chip minHeight (blocker): removed. Chips sized through textStyle keep their size again, and the body keeps the constant 8dp slop.
  • Chip slop without a handler: the body slop now also requires a touch handler, so display-only chips, chips with only onClose, and disabled chips get none.
  • Forwarded hitSlop={undefined}: IconButton and TextInput.Icon now fall back to their default when hitSlop is undefined, the same way Chip, SegmentedButtons and Button already do. 0 still opts out. The prop's type doesn't accept null, so 0 is the only opt-out.
  • borderless JSDoc: now scoped to web, using similar wording to the review.
  • Migration guide: added the sentence that hitSlop now works on web.
  • BottomNavigation on web: tab items get overflow: 'hidden' on web only, so a label wider than its tab is clipped at the tab edge again. Native is unchanged.

New tests cover the Chip handler and disabled cases and the forwarded undefined for both components. The Chip and ListItem snapshots only lose minHeight: 32, plus the body slop on chips with no handler or disabled. Typecheck, lint, tests and the package build pass.

@Doberjohn
Doberjohn merged commit a9cc9b3 into callstack:main Nov 13, 2026
10 checks passed
Stoneski93 pushed a commit to k0ndee/react-native-paper that referenced this pull request Nov 13, 2026
Stoneski93 pushed a commit to k0ndee/react-native-paper that referenced this pull request Nov 13, 2026
Material Web rings the remove button with a circle around the icon. The
ring was a rounded rectangle around the whole 34dp close column from callstack#5108,
reaching the label. Focus still lands on the column, so its touch target is
unchanged; the ring is drawn outward on a 24dp circle (4/3 of the 18dp
icon, like Material Web) inside it, through the 'descendant' scope.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Stoneski93 pushed a commit to k0ndee/react-native-paper that referenced this pull request Nov 13, 2026
The 34dp close column from callstack#5108 sized itself and its Pressable with
`height: '100%'`. On Android the column came out taller than the chip, so
the vertically centred glyph, and with it the focus ring, sat below the
chip. Stretch the column with `top: 0` / `bottom: 0` and the Pressable
with `flex: 1` instead, which lays out the same on web and keeps the glyph
centred in the chip on Android.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Stoneski93 added a commit to k0ndee/react-native-paper that referenced this pull request Nov 13, 2026
Stoneski93 added a commit to k0ndee/react-native-paper that referenced this pull request Nov 13, 2026
Material Web rings the remove button with a circle around the icon. The
ring was a rounded rectangle around the whole 34dp close column from callstack#5108,
reaching the label. Focus still lands on the column, so its touch target is
unchanged; the ring is drawn outward on a 24dp circle (4/3 of the 18dp
icon, like Material Web) inside it, through the 'descendant' scope.
Stoneski93 added a commit to k0ndee/react-native-paper that referenced this pull request Nov 13, 2026
The 34dp close column from callstack#5108 sized itself and its Pressable with
`height: '100%'`. On Android the column came out taller than the chip, so
the vertically centred glyph, and with it the focus ring, sat below the
chip. Stretch the column with `top: 0` / `bottom: 0` and the Pressable
with `flex: 1` instead, which lays out the same on web and keeps the glyph
centred in the chip on Android.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants