Skip to content

Commit

Permalink
Guard showModal() and showPopover() with fully active checks
Browse files Browse the repository at this point in the history
Closes #10659. This effectively only impacts dialogs and popovers "synthetic" documents, such as those created via document.implementation.createHTMLDocument().
  • Loading branch information
domenic committed Oct 30, 2024
1 parent 55c546a commit 70f2b06
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -61772,6 +61772,9 @@ interface <dfn interface>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
<li><p>If <span>this</span> has an <code data-x="attr-dialog-open">open</code> attribute, then
throw an <span>"<code>InvalidStateError</code>"</span> <code>DOMException</code>.</p></li>

<li><p>If <span>this</span>'s <span>node document</span> is not <span>fully active</span>, then
throw an <span>"<code>InvalidStateError</code>"</span> <code>DOMException</code>.</p></li>

<li><p>If <span>this</span> is not <span>connected</span>, then throw an
<span>"<code>InvalidStateError</code>"</span> <code>DOMException</code>.</p></li>

Expand Down Expand Up @@ -61801,9 +61804,8 @@ interface <dfn interface>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
to the top layer</span> given <span>this</span>.</p></li>

<li id="canceling-dialogs">
<p>If <span>this</span>'s <span>node document</span> is <span>fully active</span>, then set
<span>this</span>'s <span data-x="dialog-close-watcher">close watcher</span> to the result of
<span data-x="establish a close watcher">establishing a close watcher</span> given
<p>Set <span>this</span>'s <span data-x="dialog-close-watcher">close watcher</span> to the
result of <span data-x="establish a close watcher">establishing a close watcher</span> given
<span>this</span>'s <span>relevant global object</span>, with:</p>

<ul>
Expand All @@ -61817,10 +61819,6 @@ interface <dfn interface>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
<li><p><i data-x="create-close-watcher-closeAction">closeAction</i> being to <span>close the
dialog</span> given <span>this</span> and null.</p></li>
</ul>

<p class="XXX">It would be better if this method failed early for the non-<span>fully
active</span> case. That is being tracked in <a
href="https://github.com/whatwg/html/issues/10659">issue #10659</a>.</p>
</li>

<li><p>Set <span>this</span>'s <span>previously focused element</span> to the
Expand Down Expand Up @@ -85549,10 +85547,9 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
</li>

<li id="canceling-popovers">
<p>If <var>document</var> is <span>fully active</span>, then set <var>element</var>'s
<span>popover close watcher</span> to the result of <span data-x="establish a close
watcher">establishing a close watcher</span> given <var>element</var>'s <span>relevant global
object</span>, with:</p>
<p>Set <var>element</var>'s <span>popover close watcher</span> to the result of <span
data-x="establish a close watcher">establishing a close watcher</span> given
<var>element</var>'s <span>relevant global object</span>, with:</p>

<ul>
<li><p><i data-x="create-close-watcher-cancelAction">cancelAction</i> being to return
Expand All @@ -85562,10 +85559,6 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
data-x="hide popover algorithm">hide a popover</span> given <var>element</var>, true, true,
and false.</p></li>
</ul>

<p class="XXX">It would be better if this algorithm failed early for the non-<span>fully
active</span> case. That is being tracked in <a
href="https://github.com/whatwg/html/issues/10659">issue #10659</a>.</p>
</li>
</ol>
</li>
Expand Down Expand Up @@ -86108,6 +86101,9 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
<ul>
<li><p><var>element</var> is not <span>connected</span>;</p></li>

<li><p><var>element</var>'s <span>node document</span> is not <span>fully
active</span>;</p></li>

<li><p><var>expectedDocument</var> is not null and <var>element</var>'s <span>node
document</span> is not <var>expectedDocument</var>;</p></li>

Expand Down

0 comments on commit 70f2b06

Please sign in to comment.