Skip to content

Commit fcfdd9e

Browse files
authored
fix(form): shadow components using aria-labelledby do not use modern syntax (#26836)
resolves #26829
1 parent eefd17d commit fcfdd9e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

core/src/utils/forms/form-controller.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ export const createLegacyFormController = (el: HTMLLegacyFormControlElement): Le
2222
* in the light DOM.
2323
*/
2424
const hasLabelProp = (controlEl as any).label !== undefined || hasLabelSlot(controlEl);
25-
const hasAriaLabelAttribute = controlEl.hasAttribute('aria-label') || controlEl.hasAttribute('aria-labelledby');
25+
const hasAriaLabelAttribute =
26+
controlEl.hasAttribute('aria-label') ||
27+
// Shadow DOM form controls cannot use aria-labelledby
28+
(controlEl.hasAttribute('aria-labelledby') && controlEl.shadowRoot === null);
2629

2730
/**
2831
* Developers can manually opt-out of the modern form markup

0 commit comments

Comments
 (0)