-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFD] v6 successor to Listbox #411
Comments
Sorry for the delay in responding to this. @korbinancell has some in-progress work in this area that should be added to a PR here soon. As a bit of a preview, here's where our thinking is in terms of technical terminology: "Dropdown" as a term refers to the visually-hovered element that appears after certain user interactions. This component is used in two related but distinct design patterns: A "Listbox" has a "toggle" component which usually has some visual indication of the currently selected list item(s) which are available in a dropdown that is conditionally rendered/expanded. (In ARIA terms, a listbox does not have to use a dropdown, but the Styled-UI ones happen to) A "Menu" has a "toggle" component, sometimes just an icon, sometimes a button with icon and text, which opens a list of buttons or links in a dropdown. A menu does not have a concept of a currently "selected" item. These two distinct design patterns may use the same underlying primitive components, such as Dropdowns and Buttons, but could benefit from having their own distinct named exports and documentation to differentiate their different uses. |
Pending v6 Listbox update (see Faithlife#411).
* Move v5 ParameterSelect to "legacy" export * Designate main ParameterSentence component for v6 * Restructure ParameterInput for v6 Using Styled System. * Add ParameterInputBox v6 exports * Use semantic theme colors * Fix @styled-system/prop-types imports * Use DefaultThemeProvider instead of theme prop * Improve variable names * Remove no-longer-needed commented lines * Remove unused semicolon * Return object instead of array from filterProps * Add preliminary ParameterSelect component Pending v6 Listbox update (see #411). * Add ParameterSentence v6 changes to upgrade guide * Fix filterProps documentation
Resolved by PR #432 |
Dropdown.Select
Background:
I was restructuring
ParameterSelect
for v6 (#410, see also #378) when I became confused about the difference betweenListbox
andDropdown
. Looking at the Wikipedia articles "List box" and "Drop-down list", I thinkListbox
is really a specialized dropdown, since list boxes are static.It looks like the real difference between our
Dropdown
andListbox
components is thatListbox
is used like an HTML<select>
(changing the text of its button to match the option selected), whileDropdown
, by default, seems better suited as a navigation element (since its text does not change to match the option selected).Specifically describe the problem you'd like the new component to solve:
Listbox
is already built on top of v5Dropdown
, so how about we replaceListbox
in v6 with something calledDropdownSelect
, additionally exporting it asDropdown.Select
?Essentially, this would just be
Dropdown
with some additional restrictions added:selectedValue
andonItemSelect
props.Dropdown.Toggle
'schildren
is always the name of the selected item.Dropdown.Item
'sonClick
action always sets theselectedValue
.Are there existing solutions or examples where this component would help?
Only existing solutions that come to mind are various styled versions of the HTML
<select>
—in the Bootstrap world that'd be React Bootstrap's<Form.Control as="select"
or reactstrap's<Input type="select"
. But using<select>
doesn't allow for too much style customization, since each browser provides its own down arrow button and menu UI.Also, React Select is awesome and would be able to replace a lot of
<select>
-type use cases, but there are times when being able to type the option isn't always desired. And with how homogenous the examples on React Select's Styles page still look, it doesn't seem like it'd be customizable enough to replaceListbox
inParameterSelect
.Describe the proposed API:
Here would be an update of the v5
Listbox
example with the new API:The special context sent by
Dropdown.Select
would enable the different functionality ofDropdown.Toggle
andDropdown.Item
here.Are there existing specs or designs?
It'd be much like the existing
Listbox
component, just building it on top of v6Dropdown
instead of v5Dropdown
. And integrating it more into the v6Dropdown
component set.Shall I go ahead and draft a PR for this? 👍🏼
The text was updated successfully, but these errors were encountered: