From 86e4c5aff2911a5444575a7df8c9b427de8f8bba Mon Sep 17 00:00:00 2001 From: Madeorsk Date: Sun, 14 Jul 2024 19:56:17 +0200 Subject: [PATCH] Fix main content not always dimmed when a curtain is open. --- src/Components/Curtains/Curtains.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Components/Curtains/Curtains.tsx b/src/Components/Curtains/Curtains.tsx index cc2dfcd..9187141 100644 --- a/src/Components/Curtains/Curtains.tsx +++ b/src/Components/Curtains/Curtains.tsx @@ -175,9 +175,10 @@ export function CurtainsProvider({children}: React.PropsWithChildren<{}>) useEffect(() => { if ( Object.keys(curtains).filter((curtainId) => !closedCurtains[curtainId]).length > 0 - && !document.body.classList.contains("dimmed") ) // We should dim content if there is at least one open curtain. - document.body.classList.add("dimmed"); + { // Only dim if it's not already dimmed. + if (!document.body.classList.contains("dimmed")) document.body.classList.add("dimmed"); + } else // We shouldn't dim content. document.body.classList.remove("dimmed");