Skip to content

Commit cb09f8c

Browse files
committed
Further fixes to keydown vs. keyup for close requests
The original text was written based on the misunderstanding that keyup was the correct event. A small patch was made in d785cbe, but it was not complete; other parts of the text were still wrong, or overly-complex. This rewrites the relevant requirements and examples to be clearer, now that we know keydown is correct. Closes #10523.
1 parent 89a387c commit cb09f8c

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

source

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -82056,26 +82056,22 @@ body { display:none }
8205682056
<p>Fire any relevant events, per <cite>UI Events</cite> or other relevant specifications.
8205782057
<ref>UIEVENTS</ref></p>
8205882058

82059-
<p class="example">An example of relevant events in the <cite>UI Events</cite> model would be
82060-
the <code data-x="event-keydown">keydown</code> and <code data-x="event-keyup">keyup</code>
82061-
sequence that <cite>UI Events</cite> <a
82059+
<p class="example">An example of a relevant event in the <cite>UI Events</cite> model would be
82060+
the <code data-x="event-keydown">keydown</code> event that <cite>UI Events</cite> <a
8206282061
href="https://w3c.github.io/uievents/#events-keyboard-event-order">suggests</a> firing when the
8206382062
user presses the <kbd>Esc</kbd> key on their keyboard. On most platforms with keyboards, this
8206482063
is treated as a <span>close request</span>, and so would trigger these <span>close request
8206582064
steps</span>.</p>
8206682065

8206782066
<p class="example">An example of relevant events that are outside of the model given in
8206882067
<cite>UI Events</cite> would be assistive technology synthesizing an <kbd>Esc</kbd> <code
82069-
data-x="event-keydown">keydown</code> and <code data-x="event-keyup">keyup</code> sequence when
82070-
the user sends a <span>close request</span> by using a dismiss gesture.</p>
82068+
data-x="event-keydown">keydown</code> event when the user sends a <span>close request</span> by
82069+
using a dismiss gesture.</p>
8207182070
</li>
8207282071

82073-
<li><p>Let <var>event</var> be null if no such events are fired, or the <code>Event</code> object
82074-
representing one of the fired events otherwise. If multiple events are fired, which one is chosen
82075-
is <span>implementation-defined</span>, except that if <code
82076-
data-x="event-keydown">keydown</code> and <code data-x="event-keyup">keyup</code> events were
82077-
fired for the <kbd>Esc</kbd> key, the user agent must pick the <code
82078-
data-x="event-keydown">keydown</code> event.</p></li>
82072+
<li><p>Let <var>event</var> be null if no such events are fired, or the <code>Event</code>
82073+
object representing one of the fired events otherwise. If multiple events are fired, which one
82074+
is chosen is <span>implementation-defined</span>.</p></li>
8207982075

8208082076
<li><p>If <var>event</var> is not null, and its <span>canceled flag</span> is set, then
8208182077
return.</p></li>
@@ -82100,10 +82096,14 @@ body { display:none }
8210082096

8210182097
</div>
8210282098

82099+
<p>On platforms where pressing the <kbd>Esc</kbd> key is interpreted as a <span>close
82100+
request</span>, the user agent must interpret the key being pressed <em>down</em> as the close
82101+
request, instead of the key being released. Thus, in the above algorithm, the "relevant events"
82102+
that are fired must be the single <code data-x="event-keydown">keydown</code> event.</p>
82103+
8210382104
<p class="example">On platforms where <kbd>Esc</kbd> is the <span>close request</span>, the user
82104-
agent will first fire an appropriately-initialized <code data-x="event-keydown">keydown</code> and
82105-
<code data-x="event-keyup">keyup</code> event sequence. If the web developer cancels the <code
82106-
data-x="event-keyup">keyup</code> event by calling <code
82105+
agent will first fire an appropriately-initialized <code data-x="event-keydown">keydown</code>
82106+
event. If the web developer cancels the event by calling <code
8210782107
data-x="dom-Event-preventDefault">preventDefault()</code>, then nothing further happens. But if
8210882108
the event fires without being canceled, then the user agent proceeds to <span>process close
8210982109
watchers</span>.</p>

0 commit comments

Comments
 (0)