adobe / react-spectrum

A collection of libraries and tools that help you build adaptive, accessible, and robust user experiences.
https://react-spectrum.adobe.com
Apache License 2.0
13.1k stars 1.14k forks source link

radio-group keyboard navigation not working on vitest + happy-dom #7358

Open csantos-nydig opened 2 weeks ago

csantos-nydig commented 2 weeks ago

Provide a general summary of the issue here

selecting radio options using keyboard (ArrowDown and ArrowUp) is not working on vitest + happy-dom

๐Ÿค” Expected Behavior?

"pressing" ArrowDown should select the next radio button and fire its value via onChange

๐Ÿ˜ฏ Current Behavior

"pressing" ArrowDown does not select the next radio button

๐Ÿ’ Possible Solution

I'm almost sure this might be an issue on happy-dom itself, because it works fine in JSDOM.

But it's hard for me to tell what react-aria is doing that is supported by JSDOM but not supported by HAPPY-DOM.

I'm cross-linking both issues, so hopefully we can collaborate and see what needs to be done and where ๐Ÿ™ https://github.com/capricorn86/happy-dom/issues/1605

๐Ÿ”ฆ Context

No response

๐Ÿ–ฅ๏ธ Steps to Reproduce

Version

latest

What browsers are you seeing the problem on?

Other

If other, please specify.

vitest + happy-dom

What operating system are you using?

happy-dom

๐Ÿงข Your Company/Team

No response

๐Ÿ•ท Tracking Issue

No response

snowystinger commented 2 weeks ago

Can you check if it works with native radio groups? https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/radio

If I had to guess though, probably a missed case in here https://github.com/capricorn86/happy-dom/blob/8b39e38b23f7258323eb41b842aefc45ace3a814/packages/happy-dom/src/nodes/html-input-element/HTMLInputElement.ts#L1031