-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Should popover events bubble? #8888
Comments
Yes, the events should bubble like they do in chrome's implementation. I'm not sure if the default is to bubble or not to bubble, I'm having a hard time figuring it out by reading the algorithm in https://dom.spec.whatwg.org/#concept-event-fire @annevk @domenic is the default to bubble? I'd be happy to update the spec if needed. |
The default is to not bubble: https://dom.spec.whatwg.org/#concept-event-create step 2 grabs all the defaults from https://dom.spec.whatwg.org/#dictdef-eventinit . Which popover events is this issue about, specifically? In particular |
Chromium bubbles both toggle and beforetoggle events I think: https://source.chromium.org/search?q=ToggleEvent::createBubble&ss=chromium I think bubbling for popovers can be useful. I could see a webapp with lots of menus/context menus modes that would want to have a single event listener for all of them. I don't have a strong preference though. |
Yeah, I just wonder if the same reasoning applies to In general I don't feel confident about when we want to make events bubbling vs. non-bubbling, so that's why I'm falling back to consistency as a potential guiding factor. I vaguely recall @smaug---- having better intuitions here? |
Ah right, I'm fine either way honestly. |
I thought we had discussed that this would not bubble. We even discussed removing the attributes that defaulted correctly from the dispatch call site. |
It would be very confusing if some toggle events did bubble but some didn't. And that would likely also break sites which use details elements. |
I was initially thinking the same way that @nt1m (and the folks in #1533) were, that it would be handy to have it bubble. (Indeed that's why I made it bubble in Chromium.) But I can see the confusion arguments, especially with nested popovers. And there's an easy way out using capture. So +1 to changing this behavior to disable bubbling. Just to make sure: we're talking about both the |
Yes, they need to be consistent with each others. |
Let's close this issue once the tests are updated. |
I'll take care of that now... |
Per the discussion at [1], this was an oversight and popover toggle events (`beforetoggle` and `toggle`) should not bubble. [1] whatwg/html#8888 Bug: 1307772 Change-Id: I29e286a6f9a8bcd1d725fa85e200a388bde0323c
Per the discussion at [1], this was an oversight and popover toggle events (`beforetoggle` and `toggle`) should not bubble. [1] whatwg/html#8888 Closes: whatwg/html#8888 Bug: 1307772 Change-Id: I29e286a6f9a8bcd1d725fa85e200a388bde0323c
Per the discussion at [1], this was an oversight and popover toggle events (`beforetoggle` and `toggle`) should not bubble. [1] whatwg/html#8888 Closes: whatwg/html#8888 Bug: 1307772 Change-Id: I29e286a6f9a8bcd1d725fa85e200a388bde0323c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4263380 Commit-Queue: Joey Arhar <jarhar@chromium.org> Commit-Queue: Mason Freed <masonf@chromium.org> Auto-Submit: Mason Freed <masonf@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Cr-Commit-Position: refs/heads/main@{#1106907}
Per the discussion at [1], this was an oversight and popover toggle events (`beforetoggle` and `toggle`) should not bubble. [1] whatwg/html#8888 Closes: whatwg/html#8888 Bug: 1307772 Change-Id: I29e286a6f9a8bcd1d725fa85e200a388bde0323c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4263380 Commit-Queue: Joey Arhar <jarhar@chromium.org> Commit-Queue: Mason Freed <masonf@chromium.org> Auto-Submit: Mason Freed <masonf@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Cr-Commit-Position: refs/heads/main@{#1106907}
Per the discussion at [1], this was an oversight and popover toggle events (`beforetoggle` and `toggle`) should not bubble. [1] whatwg/html#8888 Closes: whatwg/html#8888 Bug: 1307772 Change-Id: I29e286a6f9a8bcd1d725fa85e200a388bde0323c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4263380 Commit-Queue: Joey Arhar <jarhar@chromium.org> Commit-Queue: Mason Freed <masonf@chromium.org> Auto-Submit: Mason Freed <masonf@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Cr-Commit-Position: refs/heads/main@{#1106907}
Closed via web-platform-tests/wpt#38571. |
Can we add tests specifically that |
Yep, I can definitely add that. I agree it is missing. |
https://bugs.webkit.org/show_bug.cgi?id=252692 rdar://105764253 Reviewed by Aditya Keerthi. They should not bubble per whatwg/html#8888 * LayoutTests/imported/w3c/web-platform-tests/html/semantics/popovers/popover-beforetoggle-opening-event.html: Confirmed that the test throws when changing `assert_false` to `assert_true`. * Source/WebCore/dom/ToggleEvent.cpp: (WebCore::ToggleEvent::ToggleEvent): Canonical link: https://commits.webkit.org/260661@main
Per a request [1], this adds a few more checks to ensure the toggle events have the right values for bubbles and cancelable. [1] whatwg/html#8888 (comment) Bug: 1307772 Change-Id: I8f3116703bbcb9dbc98df9be25c1fa03b7c2b97c
Per a request [1], this adds a few more checks to ensure the toggle events have the right values for bubbles and cancelable. [1] whatwg/html#8888 (comment) Bug: 1307772 Change-Id: I8f3116703bbcb9dbc98df9be25c1fa03b7c2b97c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4278524 Commit-Queue: Joey Arhar <jarhar@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Auto-Submit: Mason Freed <masonf@chromium.org> Cr-Commit-Position: refs/heads/main@{#1108470}
Per a request [1], this adds a few more checks to ensure the toggle events have the right values for bubbles and cancelable. [1] whatwg/html#8888 (comment) Bug: 1307772 Change-Id: I8f3116703bbcb9dbc98df9be25c1fa03b7c2b97c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4278524 Commit-Queue: Joey Arhar <jarhar@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Auto-Submit: Mason Freed <masonf@chromium.org> Cr-Commit-Position: refs/heads/main@{#1108470}
Per a request [1], this adds a few more checks to ensure the toggle events have the right values for bubbles and cancelable. [1] whatwg/html#8888 (comment) Bug: 1307772 Change-Id: I8f3116703bbcb9dbc98df9be25c1fa03b7c2b97c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4278524 Commit-Queue: Joey Arhar <jarhar@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Auto-Submit: Mason Freed <masonf@chromium.org> Cr-Commit-Position: refs/heads/main@{#1108470}
Landed: https://github.com/web-platform-tests/wpt/pull/38657/files |
… a=testonly Automatic update from web-platform-tests Stop bubbling for popover toggle events Per the discussion at [1], this was an oversight and popover toggle events (`beforetoggle` and `toggle`) should not bubble. [1] whatwg/html#8888 Closes: whatwg/html#8888 Bug: 1307772 Change-Id: I29e286a6f9a8bcd1d725fa85e200a388bde0323c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4263380 Commit-Queue: Joey Arhar <jarhar@chromium.org> Commit-Queue: Mason Freed <masonf@chromium.org> Auto-Submit: Mason Freed <masonf@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Cr-Commit-Position: refs/heads/main@{#1106907} -- wpt-commits: fec55c3d5937edb83f2b95ee5137669f7781124b wpt-pr: 38571
… a=testonly Automatic update from web-platform-tests Stop bubbling for popover toggle events Per the discussion at [1], this was an oversight and popover toggle events (`beforetoggle` and `toggle`) should not bubble. [1] whatwg/html#8888 Closes: whatwg/html#8888 Bug: 1307772 Change-Id: I29e286a6f9a8bcd1d725fa85e200a388bde0323c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4263380 Commit-Queue: Joey Arhar <jarhar@chromium.org> Commit-Queue: Mason Freed <masonf@chromium.org> Auto-Submit: Mason Freed <masonf@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Cr-Commit-Position: refs/heads/main@{#1106907} -- wpt-commits: fec55c3d5937edb83f2b95ee5137669f7781124b wpt-pr: 38571
… a=testonly Automatic update from web-platform-tests Stop bubbling for popover toggle events Per the discussion at [1], this was an oversight and popover toggle events (`beforetoggle` and `toggle`) should not bubble. [1] whatwg/html#8888 Closes: whatwg/html#8888 Bug: 1307772 Change-Id: I29e286a6f9a8bcd1d725fa85e200a388bde0323c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4263380 Commit-Queue: Joey Arhar <jarhar@chromium.org> Commit-Queue: Mason Freed <masonf@chromium.org> Auto-Submit: Mason Freed <masonf@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Cr-Commit-Position: refs/heads/main@{#1106907} -- wpt-commits: fec55c3d5937edb83f2b95ee5137669f7781124b wpt-pr: 38571
…les/cancelable, a=testonly Automatic update from web-platform-tests Update popover events test to check bubbles/cancelable Per a request [1], this adds a few more checks to ensure the toggle events have the right values for bubbles and cancelable. [1] whatwg/html#8888 (comment) Bug: 1307772 Change-Id: I8f3116703bbcb9dbc98df9be25c1fa03b7c2b97c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4278524 Commit-Queue: Joey Arhar <jarhar@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Auto-Submit: Mason Freed <masonf@chromium.org> Cr-Commit-Position: refs/heads/main@{#1108470} -- wpt-commits: 5f995902afeb84dcc1f656f2c23f5dc6547c6565 wpt-pr: 38657
Per the discussion at [1], this was an oversight and popover toggle events (`beforetoggle` and `toggle`) should not bubble. [1] whatwg/html#8888 Closes: whatwg/html#8888 Bug: 1307772 Change-Id: I29e286a6f9a8bcd1d725fa85e200a388bde0323c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4263380 Commit-Queue: Joey Arhar <jarhar@chromium.org> Commit-Queue: Mason Freed <masonf@chromium.org> Auto-Submit: Mason Freed <masonf@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Cr-Commit-Position: refs/heads/main@{#1106907}
Per a request [1], this adds a few more checks to ensure the toggle events have the right values for bubbles and cancelable. [1] whatwg/html#8888 (comment) Bug: 1307772 Change-Id: I8f3116703bbcb9dbc98df9be25c1fa03b7c2b97c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4278524 Commit-Queue: Joey Arhar <jarhar@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Auto-Submit: Mason Freed <masonf@chromium.org> Cr-Commit-Position: refs/heads/main@{#1108470}
…les/cancelable, a=testonly Automatic update from web-platform-tests Update popover events test to check bubbles/cancelable Per a request [1], this adds a few more checks to ensure the toggle events have the right values for bubbles and cancelable. [1] whatwg/html#8888 (comment) Bug: 1307772 Change-Id: I8f3116703bbcb9dbc98df9be25c1fa03b7c2b97c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4278524 Commit-Queue: Joey Arhar <jarhar@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Auto-Submit: Mason Freed <masonf@chromium.org> Cr-Commit-Position: refs/heads/main@{#1108470} -- wpt-commits: 5f995902afeb84dcc1f656f2c23f5dc6547c6565 wpt-pr: 38657
I don't think this is particularly clear from the spec. Since the spec just doesn't say anything I assume it's the default, which is no bubbling.
However, Chrome's implementation does make the events bubble, which I think can be useful if you're implementing context menu like functionality where want to have a common event listener for the whole document.
cc @josepharhar @mfreed7
The text was updated successfully, but these errors were encountered: