`<Select>` component `<form>` compatability
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 技術スタック
- react, typescript
- 領域
- frontend
調査の方向性
の実装から始め、リンクされている CodeSandbox のフォーム例を使って問題を再現してください。フォームの動作に関するコンテキストとして、関連する react-component/select の issue 790 と 791 を確認してください。既存の使い方を変更せず、名前付きの が複数選択を含む選択値をネイティブなフォーム送信に含められれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Description
Currently <Select> component is not fully <form> compatible, which means when you submit a <Form> or <form> the data from the <Select> is not included in the form submission.
How to Reproduce Bug
Submit a form which contain's <Select> (see video below or see codesandbox here)
- observe that form submission does not update the URL
- observe that no data is being sent to the backend
Motivation For Changes
1. HTML <form> compatibility
- Being
<form>compliant means that people have the additional option of using Ant's<Select>in a similar way to using a standard<select>without losing the great UX/UI that<Select>offers (for example using<Select showSearch>is awesome!)
2. Many of Ant design's existing form-related components are already <form> compliant
<Input>,<InputNumber>and<Mentions>are already<form>compliant- codesandbox testing
<form>compliance of components above https://codesandbox.io/s/draft1-testing-ant-form-compatability-forked-z35rhu?file=/app/routes/examples/checkbox-component.tsx
- Removes the need for a user of Ant Design to manually add hidden input fields . This is the same issue Tailwind Headless UI had but solved in this pull request
Proposition of Changes
The proposed changes below are backwards compatible:
-
allow user to pass
nameprop to<Select>to achieve feature compliance with regular<select>which does allownameprop (Ex:<select name="vehicle">).

-
When a user passes
nameprop to<Select>generate a hidden input (<input type="hidden" name={selectProps.name}>) and when the user selects the value from the list, addvalueattribute to the hidden input and set it to the selected value (<input type="hidden" name={selectProps.name} value={selected_value}>. Inspiration for this implementation comes from Tailwind's Headless UI react library (Github Pull Request)
For single item selection (fake code for demonstrative purpose)
<Select showSearch style={{ width: 300 }} name="job_title">
<Select.Option value="engineer">engineer</Select.Option>
<Select.Option value="teacher">teacher</Select.Option>
// This hidden input would get generated from <Select> when a `name` prop is provided
// <input type="hidden" name={select.props.name} value={the_selected_value}>
</Select>
For multi selection (fake code for demonstrative purpose) mode=tags | multiple
<Select showSearch style={{ width: 300 }} name="job_title">
<Select.Option value="engineer">engineer</Select.Option>
<Select.Option value="teacher">teacher</Select.Option>
// Any time a new item is selected a new hidden input is generated from <Select> when a `name` prop is provided
// <input type="hidden" name={select.props.name} value={the_selected_value}>
// <input type="hidden" name={select.props.name} value={the_selected_value}>
</Select>
Summary
To solve this, <Select> needs name prop support & it needs to generate a hidden <input> element for the selected value
References
Documentation for <form> comptability
<form>compatibility example Github Pull request for tailwind React UI library + example tests- documentation for `
Related Issues
- 主要言語
- TypeScript
- スター
- 938
- フォーク
- 482
- 平均マージ
- 15時間 8分
- マージ済み PR(30日)
- 2
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
react-component/select のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
react-component/select#1216 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 45/100
react-component/select#1159 ·
-
a11y 问题 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
react-component/select#1087 · リアクション 1 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 25/100
react-component/select#1086 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 30/100
react-component/select#1082 · コメント 1 件 ·
react-component/select の issue をすべて見る
似ている issue
-
VerificationGate: ATTRIBUTION quote guard never matches a normal quotation (\b around the quote) オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
danielmiessler/LifeOS#2234 ·
-
T: Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
-
Mend: dependency security vulnerability untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100