Should we support <select /> with multiple=true like ReactJS?
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 30/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- react
- Domain
- frontend
Research direction
Start by reviewing the existing value and multiple bindings described in the issue, then compare them with React's select API. Define the supported value shape and add coverage for multiple selections; the work is done when valid multi-select values compile and render without the reported browser warning.
Written by the indexing model from the issue text.
Description
In ReactJS we can easily make a multiselect component by setting our value to an array of strings instead of a single string like so:
Note
You can pass an array into the value attribute, allowing you to select multiple options in a select tag:
<select multiple={true} value={['B', 'C']}>
see: https://reactjs.org/docs/forms.html#the-select-tag
Intuitively, I thought this would be the case for ReasonReact as well, allowing us to use list(string) or array(string) to achieve the same behavior.
As of now the value of a <select /> component expects value to be a string, even when multiple=true. adding multiple=true and value=string satisfies the compiler, but we'll get an error in the browser like so:
Warning: The `value` prop supplied to <select> must be an array if `multiple` is true.
Check the render method of `Multiselect`.
in select (created by Multiselect)
in div (created by Multiselect)
in Multiselect
Now, if we try to obey the JS error we get the following error in Reason:
This expression has type string but an expression was expected of type list(string)
It would be helpful to be able to handle this with list(string) or array(string), just like ReactJS does it.
- Dominant language
- Reason
- Stars
- 3.3k
- Forks
- 344
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from reasonml/reason-react
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
reasonml/reason-react#892 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
reasonml/reason-react#769 · 4 comments · 1 reaction ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
reasonml/reason-react#753 · 1 comment ·
-
docs
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
reasonml/reason-react#717 · 1 comment ·
-
RFC
Difficulty 5/5 Over a week Newbie friendliness 25/100
reasonml/reason-react#698 · 2 reactions ·
All issues in reasonml/reason-react
Similar issues
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P3
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
tvOS
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
bvaughn/react-resizable-panels#751 · 1 comment ·
-
www.wiwo.de OpenN: AdGuard Browser Extension P3: Medium T: Annoyance
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
AdguardTeam/AdguardFilters#242026 ·
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 92/100