Skip to content

Commit

Permalink
move more user interaction stuff into algorithms
Browse files Browse the repository at this point in the history
  • Loading branch information
josepharhar committed Jan 16, 2025
1 parent c151264 commit 7a18a77
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -53857,20 +53857,27 @@ interface <dfn interface>HTMLSelectElement</dfn> : <span>HTMLElement</span> {

<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-open-picker">open the picker</dfn>. Opening the picker will either fire a
corresponding <code data-x="event-mousedown">mousedown</code> or <code
data-x="event-keydown">keydown</code> event on the <code>select</code> element. Calling
<code data-x="dom-Event-preventDefault">preventDefault()</code> on either of these events will
prevent the picker from opening. Otherwise, the picker is opened.</p>
data-x="select-open-picker">open the picker</dfn> given a corresponding <code>select</code>
element <var>select</var> and a corresponding <code data-x="event-mousedown">mousedown</code> or
<code data-x="event-keydown">keydown</code> event <var>event</var>:

<ol>
<li><p>If <var>event</var>'s <span>canceled flag</span> is set, then return.</p></li>

<li><p>Run the <span>show popover</span> algorithm given <var>select</var>'s <span>select
popover</span>, false, and <var>select</var>.</p></li>
</ol>

<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>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>
appearance</span>, then the user agent should allow the user to <dfn>focus another option</dfn>
given the new <code>option</code> element to focus <var>option</var> and a <code
data-x="event-keydown">keydown</code> event <var>event</var>:</p>

<ol>
<li><p>If <var>event</var>'s <span>canceled flag</span> is set, then return.</p></li>

<li><p>Run the <span>focusing steps</span> on <var>newOption</var>.</p></li>
</ol>

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

0 comments on commit 7a18a77

Please sign in to comment.