Skip to content

Conversation

@josepharhar
Copy link
Contributor

@josepharhar josepharhar commented Aug 5, 2025

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 #10905

(See WHATWG Working Mode: Changes for more details.)


/infrastructure.html ( diff )
/interactive-elements.html ( diff )
/popover.html ( diff )

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
Copy link
Member

@foolip foolip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Editorially looks good and makes a lot of things simpler. I just have opinions about types :)

@josepharhar
Copy link
Contributor Author

@annevk @smaug---- do yall have any feedback on this?

@smaug----
Copy link

I'm likely missing something here, but since mousedown triggers select's popup to be shown, aren't there cases when just relying on click here then immediately dismisses it.

@josepharhar
Copy link
Contributor Author

I'm likely missing something here, but since mousedown triggers select's popup to be shown, aren't there cases when just relying on click here then immediately dismisses it.

Good catch! I'm working on a fix for this, I'll try putting it in this spec PR after I get something that works well.

@josepharhar
Copy link
Contributor Author

Here is the aforementioned fix for the immediate light dismiss: #12008

@sb3nder
Copy link

sb3nder commented Dec 11, 2025

If I understand correctly, this PR will change user-facing behavior from:

(the arrows indicate a pointerdown pointerup pair, with red indicating light dismiss and green indicating no action)
light-dismiss-current

to

light-dismiss-click

If this isn’t intentional, I can suggest fixes.

demo: https://codepen.io/sb3nder/pen/qEZpXqL


Regarding #12008, I wonder if it would be better to apply the same behavior to non‑select popovers. I can suggest a small change that wouldn’t require a flag.

@josepharhar
Copy link
Contributor Author

Thanks for the images, but I'm having a hard time understanding the behavior difference. The change is released in chrome canary with experimental web platform features enabled: chrome://flags/#enable-experimental-web-platform-features

Do you think you could test it out and share a video? Or give a list of steps I can read to repro the change in behavior?

@sb3nder
Copy link

sb3nder commented Dec 11, 2025

Thank you, I tested with the Experimental Web Platform features enabled, and everything works fine for me: light-dismiss-canary

But I’m having a hard time understanding from the spec how, with just the click target, it is able to differentiate the various cases. For example, if I click-drag from a popover to <body>, the click target is <body> and it does not light-dismiss. However, if I just click <body>, the click target is <body> and it does light-dismiss. I must be missing the obvious.

Thank you.

@josepharhar
Copy link
Contributor Author

Ah good point I messed this up in the process of rewriting the chromium patch several times, I'll update this and the pointerevents spec PR soon

@josepharhar
Copy link
Contributor Author

Ok it should have substantially more detail now, please take a look. I also updated the pointerevents spec PR accordingly

</ol>
</li>
<li><p>If <var>pointerDownPopover</var> is the same as <var>pointerUpPopover</var>, then run
<span data-x="hide-all-popovers-until">hide all popovers until</span> given <var>ancestor</var>,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<span data-x="hide-all-popovers-until">hide all popovers until</span> given <var>ancestor</var>,
<span data-x="hide-all-popovers-until">hide all popovers until</span> given <var>pointerDownPopover</var>,

@sb3nder
Copy link

sb3nder commented Dec 12, 2025

Looks good to me!

My only nitpick is that, to open a modal dialog on pointerdown, one has to call preventDefault() on the cancel event, while for a popover it works out of the box when the button has the commandfor/popovertarget attribute.
EDIT: changed my mind, please ignore this in the context of this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Popovers are broken when shown in a contextmenu event listener

5 participants