-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Correct popover invokers #8993
Correct popover invokers #8993
Conversation
They need to look within the current tree, not document. There's also no need for an HTMLCollection. Tests: ? Fixes #8989.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. The existing spec is how Chromium implements this, but the result will be the same after this PR, and it's easier to understand.
@mfreed7 this is a normative change. Root vs document is not the same when shadow trees are involved. Do we have tests for this? |
Ahh! Yes I missed that nuance, thanks for checking. So that is a difference from Chromium's implementation, in the case that nested sets of popovers are all inside a shadow root: <div>
<template shadowrootmode=open>
<button popovertarget=p1>Click</button>
<div popover id=p1>Popover 1
<button popovertarget=p2>Click</button>
</div>
<div popover id=p2>Popover 2 (I'm not detected as a being related to p1)</div>
</template>
</div> There isn't a test for this case, since it's currently broken in Chromium. But I agree that the new behavior is better, I think. Are there cases that this will break, compared to the old behavior? I didn't think of any off hand, but I also feel like I could be missing one. I'm happy to add a WPT for this, once we agree this is the right behavior. |
I don't think so. Before this aspect of the specification wouldn't work inside a shadow tree. Now it does. Crossing the boundary still doesn't work, but that seems good. (This gives it parity with forms.) Please add a WPT and then this can be merged. |
See this HTML spec PR: whatwg/html#8993 It points out that it would be better to look within `root` rather than `document` for invokers. Otherwise this use case will be broken: <div> <template shadowrootmode=open> <button popovertarget=p1>Click</button> <div popover id=p1>Popover 1 <button popovertarget=p2>Click</button> </div> <div popover id=p2>Popover 2 (I'm not detected as a being related to p1)</div> </template> </div> I.e. nested popovers entirely within a shadow tree. This CL fixes that behavior and adds a test. Bug: 1307772 Change-Id: I28521ec1008d43994ca738c5673da3b704d7ba9c
Ok, sounds good, thanks.
|
See this HTML spec PR: whatwg/html#8993 It points out that it would be better to look within `root` rather than `document` for invokers. Otherwise this use case will be broken: <div> <template shadowrootmode=open> <button popovertarget=p1>Click</button> <div popover id=p1>Popover 1 <button popovertarget=p2>Click</button> </div> <div popover id=p2>Popover 2 (I'm not detected as a being related to p1)</div> </template> </div> I.e. nested popovers entirely within a shadow tree. This CL fixes that behavior and adds a test. Bug: 1307772 Change-Id: I28521ec1008d43994ca738c5673da3b704d7ba9c
See this HTML spec PR: whatwg/html#8993 It points out that it would be better to look within `root` rather than `document` for invokers. Otherwise this use case will be broken: <div> <template shadowrootmode=open> <button popovertarget=p1>Click</button> <div popover id=p1>Popover 1 <button popovertarget=p2>Click</button> </div> <div popover id=p2>Popover 2 (I'm not detected as a being related to p1)</div> </template> </div> I.e. nested popovers entirely within a shadow tree. This CL fixes that behavior and adds a test. Bug: 1307772 Change-Id: I28521ec1008d43994ca738c5673da3b704d7ba9c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4335444 Auto-Submit: Mason Freed <masonf@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Commit-Queue: Joey Arhar <jarhar@chromium.org> Cr-Commit-Position: refs/heads/main@{#1118671}
See this HTML spec PR: whatwg/html#8993 It points out that it would be better to look within `root` rather than `document` for invokers. Otherwise this use case will be broken: <div> <template shadowrootmode=open> <button popovertarget=p1>Click</button> <div popover id=p1>Popover 1 <button popovertarget=p2>Click</button> </div> <div popover id=p2>Popover 2 (I'm not detected as a being related to p1)</div> </template> </div> I.e. nested popovers entirely within a shadow tree. This CL fixes that behavior and adds a test. Bug: 1307772 Change-Id: I28521ec1008d43994ca738c5673da3b704d7ba9c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4335444 Auto-Submit: Mason Freed <masonf@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Commit-Queue: Joey Arhar <jarhar@chromium.org> Cr-Commit-Position: refs/heads/main@{#1118671}
See this HTML spec PR: whatwg/html#8993 It points out that it would be better to look within `root` rather than `document` for invokers. Otherwise this use case will be broken: <div> <template shadowrootmode=open> <button popovertarget=p1>Click</button> <div popover id=p1>Popover 1 <button popovertarget=p2>Click</button> </div> <div popover id=p2>Popover 2 (I'm not detected as a being related to p1)</div> </template> </div> I.e. nested popovers entirely within a shadow tree. This CL fixes that behavior and adds a test. Bug: 1307772 Change-Id: I28521ec1008d43994ca738c5673da3b704d7ba9c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4335444 Auto-Submit: Mason Freed <masonf@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Commit-Queue: Joey Arhar <jarhar@chromium.org> Cr-Commit-Position: refs/heads/main@{#1118671}
See this HTML spec PR: whatwg/html#8993 It points out that it would be better to look within `root` rather than `document` for invokers. Otherwise this use case will be broken: <div> <template shadowrootmode=open> <button popovertarget=p1>Click</button> <div popover id=p1>Popover 1 <button popovertarget=p2>Click</button> </div> <div popover id=p2>Popover 2 (I'm not detected as a being related to p1)</div> </template> </div> I.e. nested popovers entirely within a shadow tree. This CL fixes that behavior and adds a test. Bug: 1307772 Change-Id: I28521ec1008d43994ca738c5673da3b704d7ba9c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4335444 Auto-Submit: Mason Freed <masonf@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Commit-Queue: Joey Arhar <jarhar@chromium.org> Cr-Commit-Position: refs/heads/main@{#1118671}
See this HTML spec PR: whatwg/html#8993 It points out that it would be better to look within `root` rather than `document` for invokers. Otherwise this use case will be broken: <div> <template shadowrootmode=open> <button popovertarget=p1>Click</button> <div popover id=p1>Popover 1 <button popovertarget=p2>Click</button> </div> <div popover id=p2>Popover 2 (I'm not detected as a being related to p1)</div> </template> </div> I.e. nested popovers entirely within a shadow tree. This CL fixes that behavior and adds a test. Bug: 1307772 Change-Id: I28521ec1008d43994ca738c5673da3b704d7ba9c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4335444 Auto-Submit: Mason Freed <masonf@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Commit-Queue: Joey Arhar <jarhar@chromium.org> Cr-Commit-Position: refs/heads/main@{#1118671}
See this HTML spec PR: whatwg/html#8993 It points out that it would be better to look within `root` rather than `document` for invokers. Otherwise this use case will be broken: <div> <template shadowrootmode=open> <button popovertarget=p1>Click</button> <div popover id=p1>Popover 1 <button popovertarget=p2>Click</button> </div> <div popover id=p2>Popover 2 (I'm not detected as a being related to p1)</div> </template> </div> I.e. nested popovers entirely within a shadow tree. This CL fixes that behavior and adds a test. Bug: 1307772 Change-Id: I28521ec1008d43994ca738c5673da3b704d7ba9c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4335444 Auto-Submit: Mason Freed <masonf@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Commit-Queue: Joey Arhar <jarhar@chromium.org> Cr-Commit-Position: refs/heads/main@{#1118671}
… of document, a=testonly Automatic update from web-platform-tests Collect popover invokers on root instead of document See this HTML spec PR: whatwg/html#8993 It points out that it would be better to look within `root` rather than `document` for invokers. Otherwise this use case will be broken: <div> <template shadowrootmode=open> <button popovertarget=p1>Click</button> <div popover id=p1>Popover 1 <button popovertarget=p2>Click</button> </div> <div popover id=p2>Popover 2 (I'm not detected as a being related to p1)</div> </template> </div> I.e. nested popovers entirely within a shadow tree. This CL fixes that behavior and adds a test. Bug: 1307772 Change-Id: I28521ec1008d43994ca738c5673da3b704d7ba9c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4335444 Auto-Submit: Mason Freed <masonf@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Commit-Queue: Joey Arhar <jarhar@chromium.org> Cr-Commit-Position: refs/heads/main@{#1118671} -- wpt-commits: 887ed601ff82d1cee8a358559e2c963528e6520b wpt-pr: 38981
See this HTML spec PR: whatwg/html#8993 It points out that it would be better to look within `root` rather than `document` for invokers. Otherwise this use case will be broken: <div> <template shadowrootmode=open> <button popovertarget=p1>Click</button> <div popover id=p1>Popover 1 <button popovertarget=p2>Click</button> </div> <div popover id=p2>Popover 2 (I'm not detected as a being related to p1)</div> </template> </div> I.e. nested popovers entirely within a shadow tree. This CL fixes that behavior and adds a test. Bug: 1307772 Change-Id: I28521ec1008d43994ca738c5673da3b704d7ba9c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4335444 Auto-Submit: Mason Freed <masonf@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Commit-Queue: Joey Arhar <jarhar@chromium.org> Cr-Commit-Position: refs/heads/main@{#1118671}
They need to look within the current tree, not document. There's also no need for an HTMLCollection.
Tests: ?
Fixes #8989.
(See WHATWG Working Mode: Changes for more details.)
/popover.html ( diff )