-
Notifications
You must be signed in to change notification settings - Fork 250
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Reproduction example
https://codesandbox.io/s/user-event-invisible-button-xpw2kf
Prerequisites
- Render an invisble button:
<button onClick={() => setClicked(true)} style={{visibility: 'hidden'}}>
Click me!
</button>
- Select the button.
- Click the button using the
click
function ofuserEvent
.
Expected behavior
The click
function shouldn't work on invisible HTML elements. Maybe an error should be thrown in that case.
Actual behavior
Even though the documentation says
It adds visibility and interactability checks along the way and manipulates the DOM just like a user interaction in the browser would. It factors in that the browser e.g. wouldn't let a user click a hidden element or type in a disabled text box.
the click
function still works on the invisible button.
User-event version
14.4.3
Environment
No response
Additional context
No response
spiritanand
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working