Test environment: Originally discovered in a storybook interaction test but reproduced independent of any testing environment.
DOM implementation: browser (specifically Firefox)
Additional context
Browser versions tested:
Firefox: 115.0.3 - fails
Chrome: 115.0.5790.114 - works
Safari 16.4 - works
Looking at the implementation my best guess is that Firefox only triggers the implicit checked behavior when the event inherits from MouseEvent (as fireEvent.click uses) and not PointerEvent (as userEvent.click uses with v14+).
Reproduction example
https://codesandbox.io/s/recursing-hoover-75289w?file=/src/App.js
Prerequisites
<><label htmlFor="radio-foo">foo</label><input type="radio" id="foo" value="foo" /></>
await userEvent.click(screen.getByText('foo'))
Expected behavior
The radio input should become checked as it will in Chrome or Safari.
Actual behavior
In Firefox the radio input remains unchecked.
User-event version
14.0.0
Environment
Testing Library framework:
@testing-library/dom@9.3.1
JS framework:
react@18.2.0
Test environment: Originally discovered in a storybook interaction test but reproduced independent of any testing environment.
DOM implementation: browser (specifically Firefox)
Additional context
Browser versions tested: Firefox: 115.0.3 - fails Chrome: 115.0.5790.114 - works Safari 16.4 - works
Looking at the implementation my best guess is that Firefox only triggers the implicit checked behavior when the event inherits from
MouseEvent
(asfireEvent.click
uses) and notPointerEvent
(asuserEvent.click
uses with v14+).