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

<input> wrapped in a <label> doesn't work #1219

Closed
3 tasks done
jjonescz opened this issue Jul 10, 2023 · 5 comments
Closed
3 tasks done

<input> wrapped in a <label> doesn't work #1219

jjonescz opened this issue Jul 10, 2023 · 5 comments
Labels
unsolvable tough one

Comments

@jjonescz
Copy link

Prerequisites

  • I am running the latest version
  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed

💥 Demo Page

https://jsbin.com/fegocotaju/1/edit?html,js,output

<label>
    Label:
    <input />
</label>

Explanation

  • What is the expected behavior? I would expect it to work normally, it's just slightly modified basic example. This alternative works fine:

    <label for="tags">Label:</label>
    <input id="tags" />
  • What is happening instead? The tags input cannot be focused, the underlying text box is focused instead. If I type something anyway, the UI breaks:
    screenshot

  • What error message are you getting? None.

@yairEO
Copy link
Owner

yairEO commented Jul 11, 2023

well, it's something developers should change in their own HTML structure I guess.

@yairEO yairEO added the unsolvable tough one label Jul 11, 2023
@yairEO yairEO closed this as completed Jul 11, 2023
@jjonescz
Copy link
Author

Perhaps it could be at least documented as unsupported. It's not obvious.

@yairEO
Copy link
Owner

yairEO commented Jan 6, 2024

@jjonescz - updated the README and will be visible soon when I deploy a new version

@dmx-patrick
Copy link

I know this issue is already closed, but why not change the original input to type="hidden". This makes it hidden and prevents the focus to it and it still is being submitted with the form. It should fix this issue and the extra css to make the original input hidden is not needed.

@yairEO
Copy link
Owner

yairEO commented Feb 7, 2024

@dmx-patrick - type="hidden" is not an attribute supported by textarea tags (which tagify works with in mixed-mode). I've fixed this by setting for='' attribute to an empty string to bypass it's default functionality for focusing whatever form field is inside it. Fix will be published in next verion.

yairEO added a commit that referenced this issue Feb 11, 2024
…the focus it shifted to the hidden original field
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
unsolvable tough one
Projects
None yet
Development

No branches or pull requests

3 participants