Skip to content

Commit 157ddf4

Browse files
authoredMay 9, 2023
Merge pull request #290 from w3c/focus-order
Reflect the reality for the focus event order
2 parents 01d97fd + 46dcb8e commit 157ddf4

File tree

1 file changed

+19
-34
lines changed

1 file changed

+19
-34
lines changed
 

‎sections/event-types.txt

+19-34
Original file line numberDiff line numberDiff line change
@@ -329,13 +329,13 @@ events.
329329
=| # | Event Type | Notes |
330330
+---+------------+----------------------------------------------------+
331331
+| | | <em>User shifts focus</em> |
332-
+| 1 | focusin | Sent before first target element receives focus |
333-
+| 2 | focus | Sent after first target element receives focus |
332+
+| 1 | focus | Sent after first target element receives focus |
333+
+| 2 | focusin | Follows the focus event |
334334
+| | | <em>User shifts focus</em> |
335-
+| 3 | focusout | Sent before first target element loses focus |
336-
+| 4 | focusin | Sent before second target element receives focus |
337-
+| 5 | blur | Sent after first target element loses focus |
338-
+| 6 | focus | Sent after second target element receives focus |
335+
+| 3 | blur | Sent after first target element loses focus |
336+
+| 4 | focusout | Follows the blur event |
337+
+| 5 | focus | Sent after second target element receives focus |
338+
+| 6 | focusin | Follows the focus event |
339339
++---+------------+----------------------------------------------------+
340340

341341
<p class="note">
@@ -419,9 +419,8 @@ events.
419419

420420
A <a>user agent</a> MUST dispatch this event when an <a>event
421421
target</a> loses focus. The focus MUST be taken from the element
422-
before the dispatch of this event type. This event type is similar
423-
to EVENT{focusout}, but is dispatched after focus is shifted, and
424-
does not bubble.
422+
before the dispatch of this event type. This event type is similar
423+
to [=focusout=], but does not bubble.
425424

426425
<h5 id="event-type-focus"><dfn>focus</dfn></h5>
427426

@@ -447,9 +446,8 @@ events.
447446

448447
A <a>user agent</a> MUST dispatch this event when an <a>event
449448
target</a> receives focus. The focus MUST be given to the element
450-
before the dispatch of this event type. This event type is similar
451-
to EVENT{focusin}, but is dispatched after focus is shifted, and
452-
does not bubble.
449+
before the dispatch of this event type. This event type is similar
450+
to [=focusin=], but does not bubble.
453451

454452
<h5 id="event-type-focusin"><dfn>focusin</dfn></h5>
455453

@@ -473,22 +471,11 @@ events.
473471
| | </ul> |
474472
++------------------+--------------------------------------------------------------------------------------+
475473

476-
A <a>user agent</a> MUST dispatch this event when an <a>event
477-
target</a> is about to receive focus. This event type MUST be
478-
dispatched before the element is given focus. The <a>event
479-
target</a> MUST be the element which is about to receive focus.
480-
This event type is similar to EVENT{focus}, but is dispatched
481-
before focus is shifted, and does bubble.
482-
483-
<p class="note">
484-
When using this event type, the content author can use the event's
485-
{{FocusEvent/relatedTarget}} attribute (or a host-language-specific
486-
method or means) to get the currently focused element before the
487-
focus shifts to the next focus <a>event target</a>, thus having
488-
access to both the element losing focus and the element gaining
489-
focus without the use of the EVENT{blur} or EVENT{focusout} event
490-
types.
491-
</p>
474+
A <a>user agent</a> MUST dispatch this event when an <a>event target</a>
475+
receives focus. The <a>event target</a> MUST be the element which
476+
received focus. The [=focus=] event MUST fire before the dispatch of
477+
this event type. This event type is similar to [=focus=], but does
478+
bubble.
492479

493480
<h5 id="event-type-focusout"><dfn>focusout</dfn></h5>
494481

@@ -512,12 +499,10 @@ events.
512499
| | </ul> |
513500
++------------------+--------------------------------------------------------------------------------------+
514501

515-
A <a>user agent</a> MUST dispatch this event when an <a>event
516-
target</a> is about to lose focus. This event type MUST be
517-
dispatched before the element loses focus. The <a>event target</a>
518-
MUST be the element which is about to lose focus. This event type
519-
is similar to EVENT{blur}, but is dispatched before focus is
520-
shifted, and does bubble.
502+
A <a>user agent</a> MUST dispatch this event when an <a>event target</a>
503+
loses focus. The <a>event target</a> MUST be the element which lost
504+
focus. The [=blur=] event MUST fire before the dispatch of this event
505+
type. This event type is similar to [=blur=], but does bubble.
521506

522507
<h3 id="events-mouseevents">Mouse Events</h3>
523508

0 commit comments

Comments
 (0)
Please sign in to comment.