Loading...
const dialog = document.querySelector('dialog');
dialog.show();const dialog = document.querySelector('dialog');
dialog.showModal();showModal() puts the dialog in the top layer, so :modal and ::backdrop apply and the page behind becomes inert.
show() or the open attribute, so :modal never matches.showModal(), so :modal and ::backdrop apply.dialog:modal instead of a class added by JavaScript.dialog where needed, since fullscreen elements also match :modal.:open matches any open dialog. :modal matches only one opened with showModal(), which blocks the rest of the page.
Yes. An element shown with requestFullscreen() also matches :modal, so scope selectors to dialog:modal when needed.