Replies: 1 comment 6 replies
-
@RobinMalfait a lot of people seem to be having similar thoughts on this issue, seeing a ton of discussions being created around the same problem: #1157 I understand you are probably swamped with other stuff to think about but this issue could be easily solvable with a flag or by providing the event. As outlined in #621 you could use a noop for the close function but that is very hacky IMO and disables esc behavior and could just be a lot easier. |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The Problem:
I am using the Dialog component as well as notiwind, which is a notification system for Vue. If I have a notification pop up from notiwind while a Dialog is open and the user clicks on it, it closes the Dialog. I've tracked down the issue to this line of code which adds a listener to the
window
that triggers the close event on any click outside the Dialog. I've tried making the notification capture the click event and stop propagation to keep it from reaching the listener, but with no luck. With no information about what triggered the "close" event being passed, the only fix I've been able to find is to make the DialogOverlay handle closing the Dialog when it is clicked. This works fine for clicks, but forces me to implement the "esc" keypress event myself as well.Possible Solutions:
Give us some control over which events trigger the "close" event
One way this could be achieved is with some optional props that enable/disable the individual event listeners
where the
closeOnOutsideClick
andcloseOnEsc
props both default totrue
Pass some information about how the dialog was closed through the "close" event
Currently the "close" event just passes
true
orfalse
representing the new open state. If we were given some information about how it was triggered, we could account for that in our listenerIf you don't want to include the entire Event object in the emitted event, even just the type of event that triggered the close would be better than nothing.
Beta Was this translation helpful? Give feedback.
All reactions