vikignt/svelte-mui

Modal Dialog

sourcegr opened this issue · 3 comments

Added a new modal attribute for Dialog. When present, one cannot close the dialog by clicking on the overlay.

You can see the diff here.

https://github.com/sourcegr/svelte-ui/commit/4023211e66ad9ecba79216f85079f94e230d19a9

Same as all the others. Use it if you want etc etc

Actually, the esc key should close the Dialog, whether this is modal or not.

But since esc is merelly equivalent to pressing the "Cancel" button in any UI so far, maybe it would be good if we could assign a callback to the esc key (or even the whole closing proccess).

As a mater of fact, I think the Dialog misses some features; for example lifetime callbacks, like onopen, beforeclose

My milestone requires a "beforeclose" hook, to check if anything is dirty in the dialog and if everything is OK the Dialog may be closed. I have implemented it with a handler that returns true if the Dialog can be closed, and sets the visible attr on the component.

Thank you @sourcegr

Don't mention it my friend! I thank you!

Also, I just added comments on the diff to make the closehandler async

(not tested, but you get the idea)