salt-ds icon indicating copy to clipboard operation
salt-ds copied to clipboard

Combo box different selection and clear behaviour

Open origami-z opened this issue 7 months ago • 4 comments

Area

UI Components

The problem

Currently following is combo box behavior

  • If user select any option then they have to erase complete text or most part of the text to show complete list and update option.

  • If user adds some text and then move out and then focus inside it wont show the selected option and something wont show options to user(If previous entered text doesn't match with options).

The solution

It is good to have following things:

  • Show all option on focus

  • Show filtered selected option when user types

  • Clearing filter string if no selection is made

    • If there was no selection earlier, show blank

    • If there was a selection before, clear filter string and revert to previous selection

  • ~~Clear selection if filter string is made blank by user.~~ (done in https://github.com/jpmorganchase/salt-ds/blob/e8d923ce43d681954f54760a60b70bfa9582ed6c/packages/core/src/combo-box/ComboBox.tsx#L311-L313)

Alternatives and examples

https://codesandbox.io/p/sandbox/react-hook-form-salt-combobox-y2nd96

Are you a JPMorgan Chase & Co. employee?

  • [X] I am an employee of JPMorgan Chase & Co.

origami-z avatar Jul 09 '24 08:07 origami-z