Replies: 1 comment
-
I found a better workaround <button
onMouseDown={(e) => {
e.stopPropagation(); // <---------- magic
}}
onClick={(e) => {
setIsOpen((open) => !open);
}}
>
Toggle menu
</button> |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
We have a fixed positioned "Burger"-icon that is positioned over the overlay and transforms into a "Close"-icon on mobile.
Hence we have two different things that can get an event and trigger a
close
event - both the sticky button and the button pressed.This means, when we have the dialog open, close is triggered twice. I tried having
e.stopPropagation()
on my button, but the<Dialog/>
'sonClose
is triggered before.If the
onClose
would contain the original event, I could triggere.stopPropagation()
there.Here's the hack I have right now:
Maybe there's a better workaround?
Beta Was this translation helpful? Give feedback.
All reactions