Navigation Menu

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

A select list with multiple="false" causes the placeholder to not render #148

Closed
garylake opened this issue Mar 14, 2022 · 1 comment
Closed
Labels
🐛 bug Verified bug by team 🟡 priority-2 2. Medium priority issue 🚀 release-ready Feature or fix is complete and on an upcoming release branch

Comments

@garylake
Copy link

garylake commented Mar 14, 2022

Reproduction

https://formkit.link/c0040d42ed1e3475b3800cf0c39aea07

Describe the bug

When a select input is set to :validation="required" and it appears to have an option selected in both its open and closed states, if you proceed to not change/choose another option and click out, it fails validation despite it appearing to have a value selected as the user.

I've found this issue present in the Tailwind theme demo, as well as my own project. So, I've just created and attached a playground which is the Tailwind theme demo stripped back to just the select input.

Steps to reproduce:

  1. Load the playground
  2. Click the select input
  3. Don't change the selected option from "I like Tailwind"
  4. Click out of the select to close and click off again to lose focus
  5. Select input fails validation

Expected outcome:

  1. Click the select input
  2. Don't change the selected option from "I like Tailwind"
  3. Click out of the select to close and click off again to lose focus
  4. Select input passes validation because "I like Tailwind" was selected anyway

Evidence:

Onload:
image

Open select:
image

Click away to close select:
image

Click away again to blur:
image

Environment

• OS: MacOS 11.1
• Browser: Chrome
• Version: 99.0.4844.51

@garylake garylake added the 🐛 bug-report Bug is reported, but not verified by team label Mar 14, 2022
@justin-schroeder
Copy link
Member

Oh interesting. this is a bug, but not what it seems like — the issue is the :multiple="false" attribute, which is currently set to false, is causing the placeholder to not render, which then is making your first item the placeholder (incorrectly). There's a bug to fix here though.

In the meantime you can just return undefined instead: https://formkit.link/20ac53cdf262883a6768bf805537b002

@justin-schroeder justin-schroeder added 🐛 bug Verified bug by team and removed 🐛 bug-report Bug is reported, but not verified by team labels Mar 29, 2022
@justin-schroeder justin-schroeder changed the title Select inputs fail validation when loaded with a default value selected but you don't actively choose one/change it A select list with multiple="false" causes the placeholder to not render Mar 29, 2022
@justin-schroeder justin-schroeder added the 🟡 priority-2 2. Medium priority issue label Mar 29, 2022
@justin-schroeder justin-schroeder added this to the Beta 7 milestone Mar 29, 2022
@justin-schroeder justin-schroeder added the 🚀 release-ready Feature or fix is complete and on an upcoming release branch label May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Verified bug by team 🟡 priority-2 2. Medium priority issue 🚀 release-ready Feature or fix is complete and on an upcoming release branch
Projects
None yet
Development

No branches or pull requests

2 participants