useButton hook has narrower clickable area than native button elements on mobile devices
- Dominant language
- TypeScript
- Stars
- 15.9k
- Forks
- 1.6k
- Avg merge
- 3d 9m
- Merged PRs (30d)
- 59
Description
### Provide a general summary of the issue here
When using the useButton hook from React Aria on mobile devices, the clickable area of the button is slightly narrower than native elements. When tapping near the edges of a button using useButton on mobile, the button visually shows the :active state (appears pressed), but the onPress handler is not triggered.
This creates a confusing user experience on mobile where visual feedback suggests the button is being tapped, but the action doesn't execute.
https://github.com/user-attachments/assets/776598c6-b0f5-473f-baf5-e208514b3aeb
### 🤔 Expected Behavior?
When using the [useButton](vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/code/electron-sandbox/workbench/workbench.html) hook from React Aria on mobile devices, the clickable area of the button should match the visual boundaries of the button element, identical to the behavior of native elements.
### 😯 Current Behavior
When using the `useButton` hook from React Aria on mobile devices, the clickable area of the button is slightly narrower than native `` elements. Specifically:
- When tapping near the edges of a button implemented with `useButton` on mobile, the button visually shows the `:active` state (appears pressed), suggesting that the tap is registered
- However, the `onPress` handler is not actually triggered for these edge taps
- Native HTML `` elements don't exhibit this issue and correctly register taps across their entire visual area
This creates a confusing user experience where users receive visual feedback suggesting their tap was successful, but the expected action doesn't occur.
### 💁 Possible Solution
_No response_
### 🔦 Context
_No response_
### 🖥️ Steps to Reproduce
You can observe this behavior by visiting https://akadori.github.io/react-aria-click-boundary-issue/ in Chrome's mobile device emulation mode or on an actual mobile device. The demo shows two visually identical buttons where Button B (using React Aria's `useButton`) has a smaller effective tap area compared to Button A (native HTML button).
Reproducing code repository: https://github.com/akadori/react-aria-click-boundary-issue
### Version
react-aria@3.390
### What browsers are you seeing the problem on?
Chrome
### If other, please specify.
_No response_
### What operating system are you using?
Mac OS
### 🧢 Your Company/Team
_No response_
### 🕷 Tracking Issue
_No response_
Contributor guide
Research direction
Start with the React Aria useButton hook and run the linked reproduction in Chrome mobile device emulation, comparing Button A with Button B near the visual edges. Done means edge taps on the useButton button consistently trigger onPress just as native button taps do, without the misleading active state.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- accessibility, frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100