Skip to content

Commit

Permalink
Update focus another option
Browse files Browse the repository at this point in the history
  • Loading branch information
josepharhar committed Dec 13, 2024
1 parent dcf650b commit 9758b7b
Showing 1 changed file with 10 additions and 45 deletions.
55 changes: 10 additions & 45 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -53863,51 +53863,16 @@ interface <dfn interface>HTMLSelectElement</dfn> : <span>HTMLElement</span> {
prevent the picker from opening. Otherwise, the picker is opened.</p>

<p>If the <code>select</code> is being rendered as a <span>drop-down box</span> with <span>base
appearance</span>, then the user agent should allow the user to <dfn
data-x="select-focus-next-option">focus the next option</dfn> and <dfn
data-x="select-focus-previous-option">focus the previous option</dfn>. Performing either of these
actions will fire a corresponding <code data-x="event-keydown">keydown</code> event on the
currently focused <code>option</code> element. Calling <code
data-x="dom-Event-preventDefault">preventDefault()</code> on this event will prevent the
corresponding algorithm from running.</p>

<p>To <span data-x="select-focus-next-option">focus the next option</span> given a currently
focused <code>option</code> element <var>option</var> in a <code>select</code> element
<var>select</var>:</p>

<ol>
<li>
<p><span>While</span> <var>option</var> is not null:</p>

<ol>
<li><p>Set <var>option</var> to the next element in <var>select</var>'s <span
data-x="concept-select-option-list">list of options</span> if any such element exists;
otherwise null.</p></li>

<li><p>If <var>option</var> is not null and is <span>focusable</span>, then run the
<span>focusing steps</span> given <var>option</var> and return.</p></li>
</ol>
</li>
</ol>

<p>To <span data-x="select-focus-previous-option">focus the previous option</span> given a currently
focused <code>option</code> element <var>option</var> in a <code>select</code> element
<var>select</var>:</p>

<ol>
<li>
<p><span>While</span> <var>option</var> is not null:</p>

<ol>
<li><p>Set <var>option</var> to the previous element in <var>select</var>'s <span
data-x="concept-select-option-list">list of options</span> if any such element exists;
otherwise null.</p></li>

<li><p>If <var>option</var> is not null and is <span>focusable</span>, then run the
<span>focusing steps</span> given <var>option</var> and return.</p></li>
</ol>
</li>
</ol>
appearance</span>, then the user agent should allow the user to <dfn>focus another option</dfn>.
Performing this action will fire a corresponding <code data-x="event-keydown">keydown</code> event
on the currently focused <code>option</code> element, then run the <span>focusing steps</span> on
another <code>option</code> within the <code>select</code>. Calling <code
data-x="dom-Event-preventDefault">preventDefault()</code> on the <code
data-x="event-keydown">keydown</code> event will prevent the new <code>option</code> from being
focused.</p>

<p class="note">Implementations commonly allow the user to choose the next or previous option via
the arrow-up and arrow-down keys, or pick the first or last option via the Home or End keys.</p>

<p>If the <code data-x="attr-select-multiple">multiple</code> attribute is present, and the
element is not <span data-x="concept-fe-disabled">disabled</span>, then the user agent should
Expand Down

0 comments on commit 9758b7b

Please sign in to comment.