Skip to content

Commit

Permalink
bug: menu is not closing even after closing (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
prathameshbelurkar committed Jul 1, 2024
1 parent 0612cc2 commit 6b01bf0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/ui/Menus.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ function Toggle({ id }) {
const { openId, open, close, setPosition } = useContext(MenusContext);

function handleClick(e) {
e.stopPropagation();
const rect = e.target.closest("button").getBoundingClientRect();
openId === "" || openId !== id ? open(id) : close();
setPosition({
Expand All @@ -105,7 +106,7 @@ function Toggle({ id }) {

function List({ id, children }) {
const { openId, position, close } = useContext(MenusContext);
const ref = useOutsideClick(close);
const ref = useOutsideClick(close, false);

if (openId !== id) return null;

Expand Down

0 comments on commit 6b01bf0

Please sign in to comment.