-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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.
2025-05-16.11.18.48.mov
🤔 Expected Behavior?
When using the useButton 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 <button> elements. Specifically:
- When tapping near the edges of a button implemented with
useButtonon mobile, the button visually shows the:activestate (appears pressed), suggesting that the tap is registered - However, the
onPresshandler is not actually triggered for these edge taps - Native HTML
<button>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
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