Merge pull request #20160 from prlanzarin/u30/fix/arthurk12-screenreader-crash
fix(screen-reader): add safeguards for adding alerts
This commit is contained in:
commit
7c407567e1
@ -14,7 +14,9 @@ const ScreenReaderAlert: React.FC<Props> = ({ olderAlert }) => {
|
||||
if (olderAlert) setTimeout(() => shiftAlert(), ARIA_ALERT_EXT_TIMEOUT);
|
||||
}, [olderAlert?.id]);
|
||||
|
||||
return olderAlert
|
||||
const ariaAlertsElement = document.getElementById('aria-polite-alert');
|
||||
|
||||
return (olderAlert && olderAlert.text && ariaAlertsElement !== null)
|
||||
? createPortal(olderAlert.text, document.getElementById('aria-polite-alert') as HTMLElement)
|
||||
: null;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user