Skip to content

Commit

Permalink
Close dialog elements when the open attribute is removed
Browse files Browse the repository at this point in the history
Fixes whatwg#5802

This patch adds attribute change steps to run the dialog closing steps
whenever the open attribute is removed in order to prevent a bad state
where the dialog is hidden but modal which renders the rest of the page
inert.
  • Loading branch information
josepharhar committed Feb 5, 2024
1 parent 8027fc5 commit 128a87e
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion source
Expand Up @@ -61051,9 +61051,23 @@ interface <dfn interface>HTMLDialogElement</dfn> : <span>HTMLElement</span> {

</div>

<p>The following <span data-x="concept-element-attributes-change-ext">attribute change
steps</span>, given <var>element</var>, <var>localName</var>, <var>oldValue</var>,
<var>value</var>, and <var>namespace</var> are used for <code>dialog</code> elements:</p>

<ol>
<li><p>If <var>namespace</var> is not null, then return.</p></li>

<li><p>If <var>localName</var> is not <code data-x="attr-dialog-open">open</code>, then
return.</p></li>

<li><p>If <var>value</var> is null, then <span>close the dialog</span> given
<var>element</var>.</p></li>
</ol>

<div class="note" id="note-dialog-remove-open-attribute">
<p>Removing the <code data-x="attr-dialog-open">open</code> attribute will usually hide the
dialog. However, doing so has a number of strange additional consequences:
dialog. However, doing so used to have a number of strange additional consequences:</p>

<ul>
<li><p>The <code data-x="event-close">close</code> event will not be fired.</p></li>
Expand Down

0 comments on commit 128a87e

Please sign in to comment.