fix: prevent `a11y_label_has_associated_control` false positive for component in `<label>`

pull/12119/head
wackbyte 2 years ago
parent 7295facb6c
commit bff608bb03
No known key found for this signature in database
GPG Key ID: 5C58CEEBF64686EF

@ -0,0 +1,5 @@
---
"svelte": patch
---
fix: prevent `a11y_label_has_associated_control` false positive for component in `<label>`

@ -1086,6 +1086,7 @@ function check_element(node, state) {
if (
node.type === 'SvelteElement' ||
node.type === 'SlotElement' ||
node.type === 'Component' ||
(node.type === 'RegularElement' &&
(a11y_labelable.includes(node.name) || node.name === 'slot'))
) {

@ -1,3 +1,11 @@
<script>
import Component from './component.svelte'
</script>
<label>
<slot />
</label>
<label>
<Component />
</label>

Loading…
Cancel
Save