niutech / showModalDialog

window.showModalDialog polyfill using a <dialog> element
https://niutech.github.io/showModalDialog/demo.html
Apache License 2.0
177 stars 88 forks source link

Dialog position in FF #38

Open psined1 opened 6 years ago

psined1 commented 6 years ago

Unlike Chrome, where the dialog is perfectly centered across the screen horizontally and vertically, in FireFox, the dialog is pushed all the way down underneath the page content, so, at times, it falls outside of the page viewable area.

Can this be improved by some CSS maybe?

Also, unlike Chrome, the dialog in FF is not modal at all. It allows user interact with other controls on the form, so dialog essentially acts nothing short of a div element. Sounds like dialog suffers from sheer implementation lackluster in FF.

niutech commented 6 years ago

You have to set dom.dialog_element.enabled to true in about:config to enable <dialog> element or use a polyfill.

psined1 commented 6 years ago

Yes, already did. That took care of dialog DOM support. Alas, it offers little help to my issue...

psined1 commented 6 years ago

Worse yet, because FF dialog is not modal, it is possible to invoke the dialog more than once. Although this still results in one and only visible dialog on the screen, it is not possible to close the dialog without refreshing the page anymore. Demo page tested with FF for Mac 61.0.1 and FF for Windows 61.0.1 -

  1. click either button for the dialog to show, the dialog shows up, "Dialog argments: some argument"
  2. click once more either button for the dialog to show, this time with "Dialog argments: undefined"
  3. Attempt to close the dialog, nothing happens
  4. Refresh the page to start over
niutech commented 6 years ago

This is because Firefox does not support modal dialogs or dialog backdrop yet. As a workaround, set the preference: dom.disable_window_showModalDialog to false in about:config in order to restore the native showModalDialog() function or use a dialog polyfill.

psined1 commented 6 years ago

Thanks. Did that. Still the behavior is the same.