Now that the Popover API has landed, I'm not sure what the use case for non-modal <dialog> is. Comparing the two options:
<dialog open> I'm a non-modal dialog </dialog>
<dialog popover> I'm a non-modal dialog </dialog>
Both represent dialogs, and both are intended to be non-modal. Neither, therefore, inert the rest of the page. However, the popover version comes with several very nice-to-have features that I believe most developers prefer:
<dialog popover> is displayed in the top-layer, so you don't have to do tricks to make sure it's on top of things and non-transformed/clipped.
<dialog popover> comes with an easy declarative way to trigger, via <button popovertarget=foo>.
<dialog popover> comes with light dismiss behavior, so clicking outside or hitting ESC closes it. (<dialog popover=manual> can be used if light dismiss is undesirable.)
<dialog popover> comes with the beforetoggle event, which fires both when showing and hiding the dialog.
Given the advantages of the popover version, and no disadvantages that I can see, I'm not sure why developers should ever choose the non-popover version, when creating a non-modal dialog.
I think we should therefore deprecate dialog.show() and simplify things for developers. The guidance would then be:
- For modal dialogs, use
<dialog>.showModal().
- For non-modal dialogs, use
<dialog popover>.
(See #3567 and #9373 for efforts to bring more of the popover goodness to modal dialog.)
Now that the Popover API has landed, I'm not sure what the use case for non-modal
<dialog>is. Comparing the two options:<dialog open> I'm a non-modal dialog </dialog><dialog popover> I'm a non-modal dialog </dialog>Both represent dialogs, and both are intended to be non-modal. Neither, therefore,
inertthe rest of the page. However, the popover version comes with several very nice-to-have features that I believe most developers prefer:<dialog popover>is displayed in the top-layer, so you don't have to do tricks to make sure it's on top of things and non-transformed/clipped.<dialog popover>comes with an easy declarative way to trigger, via<button popovertarget=foo>.<dialog popover>comes with light dismiss behavior, so clicking outside or hitting ESC closes it. (<dialog popover=manual>can be used if light dismiss is undesirable.)<dialog popover>comes with thebeforetoggleevent, which fires both when showing and hiding the dialog.Given the advantages of the popover version, and no disadvantages that I can see, I'm not sure why developers should ever choose the non-popover version, when creating a non-modal dialog.
I think we should therefore deprecate
dialog.show()and simplify things for developers. The guidance would then be:<dialog>.showModal().<dialog popover>.(See #3567 and #9373 for efforts to bring more of the popover goodness to modal dialog.)