choc-autocomplete icon indicating copy to clipboard operation
choc-autocomplete copied to clipboard

Enhancement - Allow focus when using `onOpen` render prop

Open Kysluss opened this issue 7 months ago • 0 comments

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 default false to respect current functionality
  • Will need custom render onClose render prop that checks closeOnBlur otherwise you will get an infinite loop of the autocomplete closing and then immediately being opened. Alternatively could just call inputRef.current?.focus() and inputRef.current?.blur() just to make sure, but would need to verify based on other props

Kysluss avatar Aug 01 '24 00:08 Kysluss