-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Provide a general summary of the issue here
When a button is disabled, it still allows click events to propagate.
This is a problem when you have a pressable element nested within another pressable element (eg a card with a button in it).
This manifests for example if you disable a button when an action is loading.
🤔 Expected Behavior?
Even if the button is disabled, it still disallows click events to propagate.
😯 Current Behavior
When the button is disabled, click events are propagated.
https://stackblitz.com/edit/vitejs-vite-nyw2s2?file=src%2FApp.tsx
💁 Possible Solution
Disallow press event propagation when disabled
🔦 Context
This makes it so users accidentally fire the container element's onPress event if they try to press a disabled button - causing for a frustrating user experience.
🖥️ Steps to Reproduce
- Create a container element that uses
useButton - Create an inner element that uses
useButton - Disable the inner element.
- Watch events propagating through to the container element.
https://stackblitz.com/edit/vitejs-vite-nyw2s2?file=src%2FApp.tsx
Version
react-aria@3.32.1
What browsers are you seeing the problem on?
Chrome
If other, please specify.
No response
What operating system are you using?
MacOS
🧢 Your Company/Team
No response
🕷 Tracking Issue
No response