Add requestClose()
function to HTMLDialogElement
#10164
Labels
addition/proposal
New features or enhancements
needs implementer interest
Moving the issue forward requires implementers to express interest
topic: close watchers
topic: dialog
The <dialog> element.
What problem are you trying to solve?
Dialog elements have an internal close watcher which can trigger cancel events to give web developers a chance to prevent the closure. Currently there's no way for developers to get access to this functionality via anything other than the internal close watcher.
Developers will often want to trigger this same behaviour if closed through other mechanisms such as custom light dismiss for dialogs or even cancel buttons themselves.
What solutions exist today?
The developer would have to implement the cancellation logic twice once for the cancel event handler and another time for their custom cancel behaviour.
How would you solve it?
Exposing a new
requestClose()
function on dialogs that that simplified would be firing the cancel event and then firing close event (and associated dialog closing steps) if cancel wasn't prevented.Anything else?
The text was updated successfully, but these errors were encountered: