-
Notifications
You must be signed in to change notification settings - Fork 116
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
Make multi input a form control #1667
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
🦋 Changeset detectedLatest commit: 5a4a3f6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
camertron
requested review from
a team and
keithamus
and removed request for
keithamus
December 6, 2022 00:01
camertron
temporarily deployed
to
review-pr-1667
December 7, 2022 18:38
— with
GitHub Actions
Inactive
camertron
temporarily deployed
to
github-pages
December 7, 2022 18:43
— with
GitHub Actions
Inactive
camertron
had a problem deploying
to
review-pr-1667
December 8, 2022 22:31
— with
GitHub Actions
Failure
camertron
had a problem deploying
to
review-pr-1661
December 8, 2022 22:32
— with
GitHub Actions
Failure
camertron
temporarily deployed
to
github-pages
December 8, 2022 22:35
— with
GitHub Actions
Inactive
camertron
temporarily deployed
to
github-pages
December 8, 2022 22:38
— with
GitHub Actions
Inactive
camertron
had a problem deploying
to
review-pr-1667
December 8, 2022 23:25
— with
GitHub Actions
Failure
camertron
temporarily deployed
to
github-pages
December 8, 2022 23:29
— with
GitHub Actions
Inactive
jonrohan
approved these changes
Dec 8, 2022
camertron
temporarily deployed
to
github-pages
December 8, 2022 23:58
— with
GitHub Actions
Inactive
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The multi input in the forms framework is designed to wrap multiple inputs with the same name, only one of which may be visible at once. Why would anyone need such a thing, you ask? Imagine a form with a country dropdown. When the user selects "United States," the region input should show a list of US states. When the user selects "Canada," the region input should show a list of Canadian provinces. If any other country is selected, region becomes a free-form text field.
Currently, the multi input does not wrap its constituent inputs in
FormControl
- the inputs are expected to already be wrapped inFormControl
. However I believe the label and validation message, i.e. the additional markup added byFormControl
, should appear in the DOM only once. They should wrap the three inputs (US states, Canadian provinces, free-form text). Javascript handles showing and hiding the actual<select>
and<input>
elements.To that end, this PR accomplishes the following:
form_control
boolean attribute to all inputs that controls whether or notFormControl
should wrap the input. Ifform_control: false
is passed, only the input itself is rendered.FormControl
, and passesform_control: false
when creating them.primer-multi-input
custom element that provides anactivateField
method for switching between constituent fields.Integration
No. Nothing is using this field in production.
Merge checklist
Added/updated documentationAdded/updated previews