From 356a5118c5fe330098397d672ac37f5dfe4ff2de Mon Sep 17 00:00:00 2001 From: Arkadi Koifman <76536506+ArkadiK94@users.noreply.github.com> Date: Mon, 9 Oct 2023 21:04:19 +0300 Subject: [PATCH] fix: When Menu Is Open Fix Scrollable Background (#488) What: fix scrollable background when menu is open on mobile display How: add overflow hidden when menu is open so the bg will not be Scrollable Why: better user experience --- src/App.jsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/App.jsx b/src/App.jsx index 240c1cc6..1e3fcc25 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -79,7 +79,11 @@ const App = () => { }; const [isOpen, setIsOpen] = useState(false); - const toggle = () => setIsOpen(!isOpen); + const toggle = () => { + setIsOpen(!isOpen); + const overflowStatus = document.body.style.overflow; + document.body.style.overflow = overflowStatus === "hidden" ? "auto" : "hidden"; + }; const { user } = useSelector((state) => state.auth);