I was wondering what would happen if I set the 2 <label> tags, and it turns out that in all recent versions of all browsers except Opera, clicking on the internal label results in clicking only on that label. Here is a demonstration of the behavior of nested tags tags.
My question is: Are there any standards for the behavior of browsers when handling click events in nested shortcuts? All I could find was this MDN section on Gecko behavior, but I couldn't find anything about other browsers.
The reason I am interested in this is because if you can insert tag labels and you can still choose the correct input using the nearest shortcut, then you can do amazing things like this . If the behavior of nested labels is not defined in any standards (so that any browser could do whatever it wants), this will not be an option at all, even in the future. The format for any of these tabs is:
<label> <input type="radio" name="1"> <span>Shown label</span> <div>Contents of the tab</div> </label>
This tab system is already possible when there are no nested labels, assigning the for attribute to the label and id for the input, but then you have to worry about unique identifiers for each input and that is a lot more effort than just that. Here is another demonstration of this (and, as you can see, it is not possible to correctly mark the marked label).
<label for="tabN"> <span>Shown label<span> </label> <input type="radio" name="1"> <div>Contents of the tab</div>
PS: Please do not answer this question: "This is not what had to be done for input and stickers!". I know this, I'm just wondering if there are any hopes that this will be possible, including in Opera.
html standards cross-browser opera web-standards
Joeytje50
source share