fix(form): shadow components using aria-labelledby do not use modern syntax (#26836)

resolves #26829
This commit is contained in:
Liam DeBeasi
2023-02-22 16:05:31 -05:00
committed by GitHub
parent eefd17d492
commit fcfdd9e9ba

View File

@ -22,7 +22,10 @@ export const createLegacyFormController = (el: HTMLLegacyFormControlElement): Le
* in the light DOM.
*/
const hasLabelProp = (controlEl as any).label !== undefined || hasLabelSlot(controlEl);
const hasAriaLabelAttribute = controlEl.hasAttribute('aria-label') || controlEl.hasAttribute('aria-labelledby');
const hasAriaLabelAttribute =
controlEl.hasAttribute('aria-label') ||
// Shadow DOM form controls cannot use aria-labelledby
(controlEl.hasAttribute('aria-labelledby') && controlEl.shadowRoot === null);
/**
* Developers can manually opt-out of the modern form markup