diff --git a/core/src/components/loading/loading.tsx b/core/src/components/loading/loading.tsx index 21ce53a377..9c34b1b824 100644 --- a/core/src/components/loading/loading.tsx +++ b/core/src/components/loading/loading.tsx @@ -186,10 +186,20 @@ export class Loading implements ComponentInterface, OverlayInterface { }; render() { - const { message, spinner, htmlAttributes } = this; + const { message, spinner, htmlAttributes, overlayIndex } = this; const mode = getIonMode(this); + const msgId = `loading-${overlayIndex}-msg`; + /** + * If the message is defined, use that as the label. + * Otherwise, don't set aria-labelledby. + */ + const ariaLabelledBy = message !== undefined ? msgId : null; + return ( -