Closed mwannewitz closed 1 month ago
Thanks for catching this! I think it makes sense to not open the menu on focus if isReadOnly
is true even if menuTrigger="focus"
is applied. https://github.com/adobe/react-spectrum/blob/81abb2185cb3a9c52a8feaf76a136c64852aea13/packages/%40react-stately/combobox/src/useComboBoxState.ts#L324 should probably be changed to if (menuTrigger === 'focus' && !props.isReadOnly) {
to accomplish this
Provide a general summary of the issue here
The RAC ComboBox
isReadOnly
prop does not disallow selections from the combobox menu whenmenuTrigger
is set tofocus
. WithmenuTrigger='input'
the user cannot open the combobox menu and not select any of the options, nor can they change the input. WithmenuTrigger='focus'
the input still cannot be changed, but the menu keeps opening on focus, and the user can select a different option.๐ค Expected Behavior?
Even with
menuTrigger='focus'
the combobox menu should not open ifisReadOnly
is set OR the user should not be able to make a selection.๐ฏ Current Behavior
The combobox menu keeps opening on focus, the user can select a different option.
๐ Possible Solution
No response
๐ฆ Context
No response
๐ฅ๏ธ Steps to Reproduce
Sandbox: https://codesandbox.io/p/sandbox/gallant-wu-6xy5k2?file=%2Fsrc%2FApp.js Both comboboxes are set to
isReadOnly
. In the second one, you can still make a different selection.Version
react-aria-components@1.2.1
What browsers are you seeing the problem on?
Firefox, Chrome, Safari, Microsoft Edge
If other, please specify.
No response
What operating system are you using?
macOS Sonoma 14.5
๐งข Your Company/Team
No response
๐ท Tracking Issue
No response