Skip to content

IconButton: sized through style, it keeps its named size's hit slop, so the target stays under 48dp #5310

Backlog

Description

@Doberjohn

Current behaviour

IconButton reaches the 48dp minimum touch target through hit slop, but the hit slop is computed from the container of its named size (40dp for the default small), not from its laid-out size. A button made smaller through style, which is documented "for positioning and size", keeps that hit slop: with style={{ width: 30, height: 30 }} it gets 4dp on each side, a 38dp target.

Expected behaviour

The hit slop follows the laid-out size, so the target reaches 48dp.

How to reproduce?

  1. Render <IconButton icon="menu-down" iconSize={30} aria-label="Expand title" onPress={toggle} style={{ width: 30, height: 30 }} />.
  2. Read the hitSlop of the pressable in the rendered tree (React DevTools or a test renderer): 4 on each side.

Your Environment

software version
android, ios both
react-native 0.86.3 (with Expo modules 57)
react-native-paper 6.0.0-alpha.4 (main at 7ab2640)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions