mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-20 12:23:02 +00:00
fix: guard against invalid accesses
Current check does only check for presence of document and assumes the full tree below exists but that is not always the case and can lead to exceptions.
This commit is contained in:
parent
c87196c16b
commit
922bf7e2e9
1 changed files with 1 additions and 1 deletions
|
@ -31,6 +31,6 @@ export const trackModal = (openStore) =>
|
|||
});
|
||||
|
||||
modalsOpen.subscribe((openCount) => {
|
||||
if (typeof document !== "undefined")
|
||||
if (typeof document !== "undefined" && document.body && document.body.classList && typeof document.body.classList.toggle === "function")
|
||||
document.body.classList.toggle("bx--body--with-modal-open", openCount > 0);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue