Skip to content

Commit

Permalink
fix: When Menu Is Open Fix Scrollable Background (#488)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ArkadiK94 authored Oct 9, 2023
1 parent e705eb1 commit 356a511
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 356a511

Please sign in to comment.