-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Open
Description
Provide a general summary of the issue here
When loading any component that loads @react-aria/interactions under the hood (like Button), we get the error:
TypeError: Cannot set property focus of [object HTMLElement] which has only a getter
This happens when userEvent.setup() is used in the unit test:
import { userEvent } from '@testing-library/user-event';
const user = userEvent.setup();
See repro.
🤔 Expected Behavior?
I expect to be able to use testing-library's user events to click around without error.
😯 Current Behavior
The error below immediately occurs as soon as the @react-aria/interactions module is loaded:
TypeError: Cannot set property focus of [object HTMLElement] which has only a getter
💁 Possible Solution
Not sure if this is fixable here or whether it needs to be fixed in testing-library
🔦 Context
No response
🖥️ Steps to Reproduce
See this repro: https://github.com/onlywei/repro-react-aria-vitest-focus#
Version
What browsers are you seeing the problem on?
Other
If other, please specify.
vitest jsdom
What operating system are you using?
MacOS 15.5
🧢 Your Company/Team
No response
🕷 Tracking Issue
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels