choc-autocomplete
choc-autocomplete copied to clipboard
Enhancement - Allow focus when using `onOpen` render prop
See #258 for original issue where listAllValuesOnFocus
was not respected when using the onOpen
render prop due to input element not being focused. This sort of leaves the autocomplete in either the correct or undesired state depending on your use case. You may want the button to also focus the input so the user can immediately start searching, but you may also want the current functionality.
Proposal
- Add new prop
focusInputOnOpen
with defaultfalse
to respect current functionality - Will need custom render
onClose
render prop that checkscloseOnBlur
otherwise you will get an infinite loop of the autocomplete closing and then immediately being opened. Alternatively could just callinputRef.current?.focus()
andinputRef.current?.blur()
just to make sure, but would need to verify based on other props