-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Provide a general summary of the issue here
In the browser the React ARIA Button component swallows pointerdown events, meaning that other components listening on that event do not trigger.
But in a test environment clicking the Button via userEvent.click it does not swallow the event leading to tests erroneously passing.
I have created a minimal repo demonstrating this issue: https://github.com/annaet/react-aria-button-bug-demo
🤔 Expected Behavior?
Behaviour should be consistent across browser and tests.
😯 Current Behavior
Events are swallowed by Button on browser but not during tests.
💁 Possible Solution
Ideally Button would not swallow these events so that event listeners continue to work as expected.
🔦 Context
No response
🖥️ Steps to Reproduce
Clone this demo repo: https://github.com/annaet/react-aria-button-bug-demo
Run the app using npm run dev to show the browser behaviour. This shows two Menu elements that listen for pointerdown events. On an external pointerdown the menu should close.
You can open both menus at the same time, as the second button click swallows the pointerdown event meaning the first menu does not close.
The expected behaviour is in the Menu.test.tsx file, where when the second menu is clicked the first is closed.
This shows the behaviour is different between a test and development environment.
Version
"react-aria-components": "1.7.1"
What browsers are you seeing the problem on?
Chrome
If other, please specify.
No response
What operating system are you using?
OSX
🧢 Your Company/Team
Hudl
🕷 Tracking Issue
No response