dialog-polyfill icon indicating copy to clipboard operation
dialog-polyfill copied to clipboard

On Firefox, shows this on console : "Error: Failed to execute 'close' on dialog..."

Open Zardoz89 opened this issue 3 years ago • 6 comments

On Firefox, on the console shows this error every time that I close a dialog :

 Uncaught Error: Failed to execute 'close' on dialog: The element does not have an 'open' attribute, and therefore cannot be closed.
    close dialog-polyfill.js:460

Zardoz89 avatar May 28 '21 10:05 Zardoz89

The same problem here

laozhu avatar Jun 28 '21 07:06 laozhu

I'm encountering this issue - any movement on it yet?

zarahzachz avatar Apr 07 '22 15:04 zarahzachz

Well... actually you can remove this polyfill on Firefox v >= 98 . It's what I actually I did.

Zardoz89 avatar Apr 08 '22 08:04 Zardoz89

Make sure you are using the polyfill only when needed, before registering the dialog, example;

if (typeof HTMLDialogElement !== "function") {
        dialogPolyfill.registerDialog("your-dialog");
}

This should fix any errors you are having.

GrimLink avatar Apr 08 '22 08:04 GrimLink

This should fix any errors you are having.

Except if the user it's using a older Firefox release (very strange, but can happen)

Zardoz89 avatar Apr 08 '22 08:04 Zardoz89

This also happens in older versions of Safari, eg 12.1.2. We solved this by wrapping the call in a try ... catch block

willzoltan avatar Feb 17 '23 16:02 willzoltan