Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Popovers are broken when shown in a contextmenu event listener #10905

Open
jpzwarte opened this issue Jan 9, 2025 · 3 comments
Open

Popovers are broken when shown in a contextmenu event listener #10905

jpzwarte opened this issue Jan 9, 2025 · 3 comments

Comments

@jpzwarte
Copy link

jpzwarte commented Jan 9, 2025

What is the issue with the HTML Standard?

https://codepen.io/jpzwarte/pen/OPLQypz?editors=1010

If you want to use a popover for a context menu, you cannot use the contextmenu event to display the popover. The problem is that the popover is immediately light dismissed.

(not sure if this belongs in whatwg/html or whatwg/dom)

@jpzwarte
Copy link
Author

jpzwarte commented Jan 9, 2025

Perhaps the light dismiss behavior should be tweaked to not close any popovers that are shown immediately before in contextmenu, mousedown, mouseup, pointerdown, pointerup, touchstart, touchend event listeners?

@mkrause
Copy link

mkrause commented Jan 10, 2025

Maybe wrap it in a setTimeout(fn, 0) so the popover gets shown after the event.

@jpzwarte
Copy link
Author

That doesn't work in Chrome, FF or Safari. Once you increase the timeout to at least 100ms, then it sometimes works. But at that point you start to have a noticeable delay.

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

No branches or pull requests

2 participants