https://codepen.io/sidewayss/pen/Wbevapq
Open the console in CodePen and compare to JavaScript pane:
- Clicking on a label does not set focus to the element, it sets focus to the body.
I assume that the label should set focus to the htmlFor element because I see from these code search results that these elements all have a version of this declared (this one is from <space-picker>):
static formAssociated = {
like: el => el._el.picker,
role: "combobox",
changeEvent: "change",
};
It's harder to decipher in CodePen, but if you open this original version of the pen on my personal site in Chrome, go to Dev Tools, the Issues tab in the console, you'll see "Incorrect use of <label for= etc.". In the pen you'll find 4 such "violating nodes", and the bottom two are the color elements. So Chrome is not recognizing these as labelable elements.
I just tried this in my repo and setting formAssociated = {} instead of = true makes no difference there.
I can't seem to get into NudeElements in the debugger, so I'm not sure how to check if attachInternals() is actually running.
https://codepen.io/sidewayss/pen/Wbevapq
Open the console in CodePen and compare to JavaScript pane:
I assume that the label should set focus to the
htmlForelement because I see from these code search results that these elements all have a version of this declared (this one is from<space-picker>):It's harder to decipher in CodePen, but if you open this original version of the pen on my personal site in Chrome, go to Dev Tools, the Issues tab in the console, you'll see "Incorrect use of <label for= etc.". In the pen you'll find 4 such "violating nodes", and the bottom two are the color elements. So Chrome is not recognizing these as labelable elements.
I just tried this in my repo and setting
formAssociated = {}instead of= truemakes no difference there.I can't seem to get into NudeElements in the debugger, so I'm not sure how to check if
attachInternals()is actually running.