GoogleChrome / dialog-polyfill

Polyfill for the HTML dialog element
BSD 3-Clause "New" or "Revised" License
2.45k stars 245 forks source link

oncancel listener doesn't work #199

Closed kippo closed 4 years ago

kippo commented 4 years ago

The oncancel listener doesn't fire an event when the modal is cancelled through either dialog.close or using the escape key. Tested in firefox but assuming this doesn't work in either IE or Safari as well.

samthor commented 4 years ago

I've added this and it will release in the next version.

Technically the ordering of "on..." events is crazy—if you set an oncancel property, it gets inserted in the list of events added by addEventListener. I've not done this, instead just calling it first if it exists.