diff --git a/bigbluebutton-html5/imports/ui/components/screenreader-alert/component.jsx b/bigbluebutton-html5/imports/ui/components/screenreader-alert/component.jsx index f4d5a2c5b6..9e9947a89f 100644 --- a/bigbluebutton-html5/imports/ui/components/screenreader-alert/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/screenreader-alert/component.jsx @@ -9,7 +9,10 @@ const ScreenReaderAlert = ({ olderAlert }) => { if (olderAlert) setTimeout(() => removeAlert(olderAlert.id), ARIA_ALERT_EXT_TIMEOUT); }, [olderAlert?.id]); - return olderAlert ? createPortal(olderAlert.text, document.getElementById('aria-polite-alert')) : null; + const ariaAlertsElement = document.getElementById('aria-polite-alert'); + const shouldAddAlert = olderAlert && olderAlert.text && ariaAlertsElement !== null; + + return shouldAddAlert ? createPortal(olderAlert.text, ariaAlertsElement) : null; }; export default ScreenReaderAlert;