react-spectrum
463ee264 - fix(focus): handle single radio button in FocusScope (#9587)

Commit
26 days ago
fix(focus): handle single radio button in FocusScope (#9587) * fix(focus): handle single radio button in FocusScope Fixes #9569 form.elements.namedItem() returns an Element (not RadioNodeList) when there is exactly one element with that name. This caused TypeError when trying to spread a non-iterable Element. The fix checks if namedItem() returns a single Element before spreading, handling all three possible return types per the DOM spec: - RadioNodeList (iterable) for 2+ elements with the same name - Element (NOT iterable) for exactly 1 element - null for no elements * Update packages/@react-aria/focus/src/FocusScope.tsx * Update packages/@react-aria/focus/src/FocusScope.tsx * Add getOwnerWindow import to FocusScope --------- Co-authored-by: Robert Snow <snowystinger@gmail.com>
Author
Parents
Loading