Skip to content

closedby attribute doesn't work when dialog uses the popover API #11105

Open
@o-t-w

Description

@o-t-w

What is the issue with the HTML Standard?

Non-modal dialogs should be able to make use of the closedby attribute.

A dialog using the .show() method or open attribute does not make use of the top layer, which can lead to issues with z-index. For that reason, combining the dialog element with the popover attribute is probably a better approach for non-modal dialogs (There's an open issue with many thumbs ups for deprecating dialog.show(). There is no invoker command to open a non-modal dialog precisely because combining show-popover with <dialog> is considered a better approach for this use case).

<dialog popover="auto"> has equivalent close behaviour to closedby=any. <dialog popover="manual"> has the same close behaviour as closedby=none. There's no equivalent for closedby=close-request. For some non-modal dialog use cases, I do not want light dismiss when the user clicks the page but I do want the escape key to close the dialog. Currently I would need to manually add this behaviour with JavaScript via a CloseWatcher. This is fairly trivial but I do think the current behaviour will trip people up.

The closedby attribute is a way for developers to state via HTML how a dialog can be closed. The way it is currently specced, it does not work when the dialog has been shown via .showPopover(). This is unfortunate. Not only is it a simpler approach than using script, it represents a consistent way to solve this issue. Seeing as closedby is a very explicit way to specify what behaviour is wanted, it should override the popover behaviour.

The closedby attribute is for dialogs, and regardless of how it gets shown, if an element is a dialog, the developer expectation will be that they can use closedby. Both the following examples should be specced to work:

<dialog closedby="closerequest" popover="manual">
A non-modal popover dialog in the top layer.
</dialog>

<dialog closedby="closerequest" popover="auto">
A non-modal popover dialog in the top layer.
</dialog>

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions