Open prasanna1211 opened 4 years ago
Okay, I went through all the types of Combo-Box and their examples in WAI-ARIA practices. Aren't going to do the basic select where the Combo-Box is not editable just shows the listbox to select any option(like a native select)?
Like: A basic single select in https://react-select.com/home
Happy to get on a call to describe the feature set I'm after.
Features required: Ideal if we could achieve combobox + listbox behavior in a single component (ref downshift useselect) if not it's okay to have to components.
Definitely building 'dialog' variant.
.....
@prasanna1211, I think you might have missed the Right Key
navigation support.
Keyboard | Behaviour |
---|---|
Right Arrow | Focus to input without closing popup and handle cursor |
https://www.w3.org/TR/wai-aria-practices/examples/combobox/aria1.1pattern/listbox-combo.html
See Material UI - https://material-ui.com/components/autocomplete/ They have better combo-box too.
Should we always need react-window to render the options? Like whatever be the no. of options. What if the no. of options are less than 10.
@navin-moorthy Not necessarily only if the results are large. Need to have a hard limit.
Dynamic popup positioning The popup should be dynamically positioned based on the window size.
This is the default behavior of Popper, I guess we don't need to do anything for dynamic positioning.
@navin-moorthy Not necessarily only if the results are large. Need to have a hard limit.
Okay, got it.
@navin-moorthy Yes, our component should use Popper JS. That is the implication of that behaviour.
@navin-moorthy Yes, our component should use Popper JS. That is the implication of that behaviour.
Clear
Definitition:
A Combo Box [CB] is an input widget with an associated popup that enables users to select a value for the combobox from a collection of possible values
Combo Box [CB] vs List Box [LB]
LB is simply a list of items, while a CB is a combination of a List box and an input that can be edited
Behaviours for Combobox v0.1
When we type:
When we trigger dropdown:
Keyboard Navigations as per keyboard Navigations section
Virtualized List The list must be scrollable, virtualized (preferably react-window)
Dynamic popup positioning The popup should be dynamically positioned based on the window size.
Functionalities
1. API Fetchable: Results should be populated from a resolved promise and ability to pick first few elements out of it
2. Clearable The selected should be clearable by clear icon (or) typing during input focus.
3. Disabled option state: Few options can be disabled.
Import
Component Parts:
Usage
Props
ComboBox Props (Provides Context composed Box(div))
ComboBoxInput with GhostSelected Props(composes Input)
ComboBoxPopper (composes Popper)
ComboBoxList(Listbox) Props (composes React-Window List)
ComboBoxOption Props (composes Box)
Keyboard navigations:
Edit Box
Popup
Further Improvements
isAsync