Skip to content

Fix react-select ignoring HTML5 "form" attribute #3892

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

Merged
merged 5 commits into from
Apr 29, 2020

Conversation

MrLeebo
Copy link
Contributor

@MrLeebo MrLeebo commented Jan 4, 2020

Issue: react-select ignores the HTML5 "form" attribute, which you can use to specify which form element to submit when the user presses "Enter" while the Select has focus.

Repro: https://codesandbox.io/s/jovial-montalcini-7dppv

Steps:

  1. Using a modern browser, focus the "Name" field and press "Enter", a green toast should appear.
  2. Focus the "Role" field and press "Enter" twice, once to close the menu and again to submit. Nothing happens.
  3. Check the checkbox to "fix" the Input component.
  4. Repeat step Auto select first option and populate field #2, the toast should appear.

Reference for the "form" attribute
https://devdocs.io/html/element/input#form

@changeset-bot
Copy link

changeset-bot bot commented Jan 4, 2020

🦋 Changeset is good to go

Latest commit: aadc77d

We got this.

This PR includes changesets to release 1 package
Name Type
react-select Patch

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

@flexdinesh
Copy link
Collaborator

Hey @MrLeebo! Thanks for the PR. We also need to add form as an optional param to this prop types here —

export type InputProps = PropsWithStyles & {

Lemme know if you need more info here.

@flexdinesh flexdinesh self-requested a review April 24, 2020 01:04
@flexdinesh flexdinesh added issue/bug-confirmed Issues about a bug that has been confirmed by a maintainer enhancement and removed issue/bug-confirmed Issues about a bug that has been confirmed by a maintainer labels Apr 24, 2020
@MrLeebo
Copy link
Contributor Author

MrLeebo commented Apr 24, 2020

@flexdinesh Like so?

@flexdinesh
Copy link
Collaborator

That's it. Thanks @MrLeebo!

@Reflex-Gravity
Copy link
Contributor

After we add form attribute to Select, and when we get all the field values in a form via FormData. It doesn't consider the Select field.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants