Skip to content
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

Find a way to make SelectNext work as a native form control #1539

Open
acelaya opened this issue Apr 30, 2024 · 0 comments
Open

Find a way to make SelectNext work as a native form control #1539

acelaya opened this issue Apr 30, 2024 · 0 comments

Comments

@acelaya
Copy link
Contributor

acelaya commented Apr 30, 2024

SelectNext is currently a controlled component which only propagates its selected value via callback props.

Our intention long term is to use it as a drop-in repacement of native selects, but for that, we need to be able to:

  1. Submit the value of SelectNext if it is part of a <form />.
  2. Trigger native form validations and avoid form submits if selected value is not valid.

Some possible solutions to cover both:

  1. Render an input[type="hidden"] with the component. Some libraries like headless UI follow this approach.
  2. Render a hidden native <select /> which maps selected value. This is what react-aria does.
  3. Use HTMLElement.attachInternals, but this requires using a custom element somehow.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant