Skip to content

Commit c6b3f85

Browse files
committed
Change light dismiss to use click events
This PR replaces the existing pointerdown and pointerup listening and tracking with algorithms which use a click event. The click event is going to be used by the pointerevents spec here: w3c/pointerevents#460 Using click events instead of doing click detection with pointerdown and pointerup fixes a number of issues which are detailed here: w3c/pointerevents#542 Fixes whatwg#10905
1 parent 307f1ad commit c6b3f85

File tree

1 file changed

+24
-64
lines changed

1 file changed

+24
-64
lines changed

source

Lines changed: 24 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -63063,9 +63063,6 @@ interface <dfn interface>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
6306363063

6306463064
<hr>
6306563065

63066-
<p>Each <code>Document</code> has a <dfn>dialog pointerdown target</dfn>, which is an <span
63067-
data-x="HTMLDialogElement">HTML dialog element</span> or null, initially null.</p>
63068-
6306963066
<p>Each <span data-x="html elements">HTML element</span> has a <dfn>previously focused
6307063067
element</dfn> which is null or an element, and it is initially null. When <code
6307163068
data-x="dom-dialog-showModal">showModal()</code> and <code data-x="dom-dialog-show">show()</code>
@@ -63528,7 +63525,8 @@ interface <dfn interface>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
6352863525
data-x="attr-dialog-closedby-any-state">Any</span> state will close the <code>dialog</code> element. This
6352963526
is in addition to how such <code>dialog</code>s respond to <span data-x="close request">close requests</span>.</p>
6353063527

63531-
<p>To <dfn>light dismiss open dialogs</dfn>, given a <code>PointerEvent</code> <var>event</var>:</p>
63528+
<p>To <dfn>light dismiss open dialogs</dfn>, given a <code data-x="event-click">click</code> event
63529+
<var>event</var>:</p>
6353263530

6353363531
<ol>
6353463532
<li><p><span>Assert</span>: <var>event</var>'s <code
@@ -63543,42 +63541,24 @@ interface <dfn interface>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
6354363541
<li><p>Let <var>ancestor</var> be the result of running <span>nearest clicked dialog</span>
6354463542
given <var>event</var>.</p></li>
6354563543

63546-
<li><p>If <var>event</var>'s <code data-x="dom-Event-type">type</code> is
63547-
"<code data-x="event-pointerdown">pointerdown</code>", then set <var>document</var>'s
63548-
<span>dialog pointerdown target</span> to <var>ancestor</var>.</p></li>
63549-
63550-
<li>
63551-
<p>If <var>event</var>'s <code data-x="dom-Event-type">type</code> is
63552-
"<code data-x="event-pointerup">pointerup</code>", then:</p>
63553-
63554-
<ol>
63555-
<li><p>Let <var>sameTarget</var> be true if <var>ancestor</var> is <var>document</var>'s
63556-
<span>dialog pointerdown target</span>.</p></li>
63557-
63558-
<li><p>Set <var>document</var>'s <span>dialog pointerdown target</span> to null.</p></li>
63559-
63560-
<li><p>If <var>sameTarget</var> is false, then return.</p></li>
63561-
63562-
<li><p>Let <var>topmostDialog</var> be the last element of <var>document</var>'s <span>open
63563-
dialogs list</span>.</p></li>
63544+
<li><p>Let <var>topmostDialog</var> be the last element of <var>document</var>'s <span>open
63545+
dialogs list</span>.</p></li>
6356463546

63565-
<li><p>If <var>ancestor</var> is <var>topmostDialog</var>, then return.</p></li>
63547+
<li><p>If <var>ancestor</var> is <var>topmostDialog</var>, then return.</p></li>
6356663548

63567-
<li><p>If <var>topmostDialog</var>'s <span>computed closed-by state</span> is not <span
63568-
data-x="attr-dialog-closedby-any-state">Any</span>, then return.</p></li>
63549+
<li><p>If <var>topmostDialog</var>'s <span>computed closed-by state</span> is not <span
63550+
data-x="attr-dialog-closedby-any-state">Any</span>, then return.</p></li>
6356963551

63570-
<li><p><span>Assert</span>: <var>topmostDialog</var>'s <span
63571-
data-x="dialog-close-watcher">close watcher</span> is not null.</p></li>
63552+
<li><p><span>Assert</span>: <var>topmostDialog</var>'s <span
63553+
data-x="dialog-close-watcher">close watcher</span> is not null.</p></li>
6357263554

63573-
<li><p><span data-x="close-watcher-request-close">Request to close</span>
63574-
<var>topmostDialog</var>'s <span data-x="dialog-close-watcher">close watcher</span> with
63575-
false.</p></li>
63576-
</ol>
63577-
</li>
63555+
<li><p><span data-x="close-watcher-request-close">Request to close</span>
63556+
<var>topmostDialog</var>'s <span data-x="dialog-close-watcher">close watcher</span> with
63557+
false.</p></li>
6357863558
</ol>
6357963559

63580-
<p>To <dfn>run light dismiss activities</dfn>, given a <code>PointerEvent</code>
63581-
<var>event</var>:</p>
63560+
<p>To <dfn>run light dismiss activities</dfn>, given a <code data-x="event-click">click</code>
63561+
event <var>event</var>:</p>
6358263562

6358363563
<ol>
6358463564
<li><p>Run <span>light dismiss open popovers</span> with <var>event</var>.</p></li>
@@ -63590,8 +63570,8 @@ interface <dfn interface>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
6359063570
href="https://github.com/w3c/pointerevents/pull/460">Pointer Events spec</a> when the user clicks
6359163571
or touches anywhere on the page.</p>
6359263572

63593-
<p>To find the <dfn>nearest clicked dialog</dfn>, given a <code>PointerEvent</code>
63594-
<var>event</var>:</p>
63573+
<p>To find the <dfn>nearest clicked dialog</dfn>, given a <code data-x="event-click">click</code>
63574+
event <var>event</var>:</p>
6359563575

6359663576
<ol>
6359763577
<li><p>Let <var>target</var> be <var>event</var>'s <span
@@ -87382,9 +87362,6 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
8738287362
data-x="popover-showing-state">showing</dfn></p></li>
8738387363
</ul>
8738487364

87385-
<p>Every <code>Document</code> has a <dfn>popover pointerdown target</dfn>, which is an <span
87386-
data-x="HTML elements">HTML element</span> or null, initially null.</p>
87387-
8738887365
<p>Every <span data-x="HTML elements">HTML element</span> has a <dfn>popover invoker</dfn>, which
8738987366
is an <span data-x="HTML elements">HTML element</span> or null, initially set to null.</p>
8739087367

@@ -88550,8 +88527,8 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
8855088527
data-x="attr-popover-auto-state">Auto</span> state will close the popover. This is in addition to
8855188528
how such popovers respond to <span data-x="close request">close requests</span>.</p>
8855288529

88553-
<p>To <dfn>light dismiss open popovers</dfn>, given a <code>PointerEvent</code>
88554-
<var>event</var>:</p>
88530+
<p>To <dfn>light dismiss open popovers</dfn>, given a <code data-x="event-click">click</code>
88531+
event <var>event</var>:</p>
8855588532

8855688533
<ol>
8855788534
<li><p><span>Assert</span>: <var>event</var>'s <code
@@ -88567,31 +88544,14 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
8856788544

8856888545
<li><p>If <var>topmostPopover</var> is null, then return.</p></li>
8856988546

88570-
<li><p>If <var>event</var>'s <code data-x="dom-Event-type">type</code> is "<code
88571-
data-x="event-pointerdown">pointerdown</code>", then: set <var>document</var>'s <span>popover
88572-
pointerdown target</span> to the result of running <span>topmost clicked popover</span> given
88573-
<var>target</var>.</p></li>
88574-
88575-
<li>
88576-
<p>If <var>event</var>'s <code data-x="dom-Event-type">type</code> is "<code
88577-
data-x="event-pointerup">pointerup</code>", then:</p>
88578-
88579-
<ol>
88580-
<li><p>Let <var>ancestor</var> be the result of running <span>topmost clicked popover</span>
88581-
given <var>target</var>.</p></li>
88582-
88583-
<li><p>Let <var>sameTarget</var> be true if <var>ancestor</var> is <var>document</var>'s
88584-
<span>popover pointerdown target</span>.</p></li>
88547+
<li><p>Let <var>ancestor</var> be the result of running <span>topmost clicked popover</span>
88548+
given <var>target</var>.</p></li>
8858588549

88586-
<li><p>Set <var>document</var>'s <span>popover pointerdown target</span> to null.</p></li>
88587-
88588-
<li><p>If <var>ancestor</var> is null, then set <var>ancestor</var> to
88589-
<var>document</var>.</p></li>
88550+
<li><p>If <var>ancestor</var> is null, then set <var>ancestor</var> to
88551+
<var>document</var>.</p></li>
8859088552

88591-
<li><p>If <var>sameTarget</var> is true, then run <span data-x="hide-all-popovers-until">hide
88592-
all popovers until</span> given <var>ancestor</var>, false, and true.</p></li>
88593-
</ol>
88594-
</li>
88553+
<li><p>Run <span data-x="hide-all-popovers-until">hide all popovers until</span> given
88554+
<var>ancestor</var>, false, and true.</p></li>
8859588555
</ol>
8859688556

8859788557
<p>To find the <dfn>topmost clicked popover</dfn>, given a <code>Node</code> <var>node</var>:</p>

0 commit comments

Comments
 (0)