<label> around an input field eats following elements
See original GitHub issueI’m not sure what the problem is, but if I have an input field inside a label as recommended by mdn:
bel(`<div>
<label> <input type="checkbox" checked> text </label>
<a>outside</a>
</div>`).toString();
// ->
<div>
<label> <input type="text" type="type" checkbox"="checkbox"" />
<a>outside</a>
</label>
</div>
… The following elements somehow teleport inside the label.
[Edited: Added
checked
to the input tag, which is required to reproduce the bug.]
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
The Label element - HTML: HyperText Markup Language | MDN
To explicitly associate a <label> element with an <input> element, you first need to add the id attribute to the <input> element.
Read more >Labeling Controls | Web Accessibility Initiative (WAI) - W3C
Provide labels to identify all form controls, including text fields, checkboxes, radio buttons, and drop-down menus. In most cases, this is done by...
Read more >HTML label tag - W3Schools
The <label> tag defines a label for several elements: ... clicks the text within the <label> element, it toggles the input (this increases...
Read more >Can a label only refer to input elements? - Stack Overflow
The <label> tag defines a label for an input element. [Emphasis mine]. Does this mean that the following HTML isn't valid? <!doctype ...
Read more >HTML <label> Tag - W3docs
The <label> tag defines a text label for the <input> tag. The label is a normal text, by clicking which, the user can...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Probably related to https://github.com/shama/bel/issues/28
I’ll look into this again soon. That and
<br/>
doesn’t work but<br />
does!