You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The issue involves browser autofill not functioning correctly with dropdowns in React Aria. While the library's useHiddenSelect hook uses a visually hidden <select> element for autofill compatibility, the onChange handler in its selectProps does not receive the correct e.target.value when autofill is triggered. This is likely due to how the useEffectEvent hook manages event handlers, potentially causing synchronization issues between React's synthetic events and native browser autofill events. As a result, the dropdown's state fails to update with the autofilled value, disrupting expected behavior.
🤔 Expected Behavior?
When browser autofill is triggered on a dropdown using React Aria, the hidden <select> element should seamlessly integrate with the autofill functionality. The onChange handler within the useHiddenSelect hook's selectProps should capture the event and receive the correct value in e.target.value, reflecting the autofilled selection. This value should then update the component's state (state.selectedKey) to ensure the dropdown displays the autofilled choice accurately. The entire process should be smooth and consistent, aligning with native autofill behavior across all supported browsers.
😯 Current Behavior
Currently, when browser autofill is used on dropdowns in React Aria, the interaction breaks down at the onChange handler of the hidden <select> element. Instead of receiving the expected autofilled value, e.target.value is empty (""). This prevents the component's state (state.selectedKey) from updating to reflect the autofilled input. While the library's implementation attempts to handle autofill through the visually hidden <select>, it appears that native autofill events are not being processed correctly, leading to a disconnect between the browser's autofill mechanism and the component's event handling.
Provide a general summary of the issue here
The issue involves browser autofill not functioning correctly with dropdowns in React Aria. While the library's
useHiddenSelect
hook uses a visually hidden<select>
element for autofill compatibility, theonChange
handler in itsselectProps
does not receive the correcte.target.value
when autofill is triggered. This is likely due to how theuseEffectEvent
hook manages event handlers, potentially causing synchronization issues between React's synthetic events and native browser autofill events. As a result, the dropdown's state fails to update with the autofilled value, disrupting expected behavior.🤔 Expected Behavior?
When browser autofill is triggered on a dropdown using React Aria, the hidden
<select>
element should seamlessly integrate with the autofill functionality. TheonChange
handler within theuseHiddenSelect
hook'sselectProps
should capture the event and receive the correct value ine.target.value
, reflecting the autofilled selection. This value should then update the component's state (state.selectedKey
) to ensure the dropdown displays the autofilled choice accurately. The entire process should be smooth and consistent, aligning with native autofill behavior across all supported browsers.😯 Current Behavior
Currently, when browser autofill is used on dropdowns in React Aria, the interaction breaks down at the
onChange
handler of the hidden<select>
element. Instead of receiving the expected autofilled value,e.target.value
is empty (""
). This prevents the component's state (state.selectedKey
) from updating to reflect the autofilled input. While the library's implementation attempts to handle autofill through the visually hidden<select>
, it appears that native autofill events are not being processed correctly, leading to a disconnect between the browser's autofill mechanism and the component's event handling.💁 Possible Solution
No response
🔦 Context
No response
🖥️ Steps to Reproduce
-https://codesandbox.io/p/sandbox/focused-water-lhqtty
HiddenSelect.mjs
anduseEffectEvent.mjs
.onChange
function inHiddenSelect.mjs
.const f = ref.current!;
inuseEffectEvent.mjs
.e.target.value
) is lost in theonChange
handler, causing the dropdown state not to update.Version
3.39.0
What browsers are you seeing the problem on?
Chrome
If other, please specify.
No response
What operating system are you using?
Windows
🧢 Your Company/Team
No response
🕷 Tracking Issue
No response
The text was updated successfully, but these errors were encountered: