Skip to content

Commit

Permalink
Reset focus when refocusing document with a moved element
Browse files Browse the repository at this point in the history
  • Loading branch information
noamr committed Oct 31, 2024
1 parent b746a3d commit f6e9fbe
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -1872,6 +1872,12 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
data-x="concept-element-local-name">local name</span>, then run the corresponding <span>HTML
element moving steps</span> given <var>movedNode</var>.</p></li>

<li><p>If <var>movedNode</var> is a <span>shadow-including inclusive ancestor</span> of
<var>movedNode</var>'s <span>node document</span>'s
<span data-x="focused area of the document">focused area</span>'s <span>DOM anchor</span>, then
set <var>movedNode</var>'s <span>node document</span> <span>should reapply focusing steps</span>
to true.</p></li>

<li>
<p>If <var>movedNode</var> is a <span>form-associated element</span> or the ancestor of a
<span>form-associated element</span>, then:</p>
Expand Down Expand Up @@ -79449,6 +79455,9 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
anchor</span> of a <span>focusable area</span> of the <span>currently focused area of a top-level
traversable</span>, it is <dfn>focused</dfn>.</p>

<p>Each <code>Document</code> has a boolean <dfn>should reapply focusing steps</dfn>, initially
false.

<div w-nodev>

<p>The <dfn>focus chain</dfn> of a <span>focusable area</span> <var>subject</var> is the ordered
Expand Down Expand Up @@ -80031,6 +80040,20 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
navigable</span>'s <span data-x="nav-document">active document</span>.</p></li>
<!-- https://software.hixie.ch/utilities/js/live-dom-viewer/?saved=2818 -->

<li>
<p>If <var>new focus target</var> is a <span>focusable area</span> whose
<span>DOM anchor</span>'s <span>node document</span>'s
<span>should reapply focusing steps</span> is true, then set <var>new focus target</var>'s
<span>DOM anchor</span>'s <span>node document</span>'s
<span data-x="focused area of the document">focused area</span> to
<span>DOM anchor</span>'s <span>node document</span>'s <span>viewport</span> and set
<span>DOM anchor</span>'s <span>node document</span>'s
<span>should reapply focusing steps</span> to false.</p>

<p class=note>This ensures that <code data-x="event-focus">focus</code> events are fired when an
element is <span data-x="concept-node-move-ext">moved</span> in the DOM.
</li>

<li><p>If <var>new focus target</var> is a <span>focusable area</span> and its <span>DOM
anchor</span> is <span>inert</span>, then return.</p></li>

Expand Down

0 comments on commit f6e9fbe

Please sign in to comment.