Description
When trying to use the element declaratively with the open
attribute, the dialog is created as a "non-modal", with no ::backdrop selector. However, the UA-styled backdrop is still shown.
I am unsure of the background to the decision for this but only having an imperative JS method to show a HTML modal impacts zero-js or sites whose users have JS disabled. It also feels unnecessary, especially with things like CSS toggle()
and popovertarget
allowing basic state-changes without JS.
An example I could think of could be a paywall news site that returns html with a modal covering the screen asking to subscribe, without wanting to wait for the client side to activate the modal.
Perhaps something like <dialog open modal />
could solve this. Otherwise it should at least be possible to style the default UA ::backdrop element when using <dialog open>
without JS.
Apologies if I'm missing anything or have overlooked something. The w3c github org is rather daunting being so massive.