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

Correct popover invokers #8993

Merged
merged 1 commit into from
Mar 14, 2023
Merged

Correct popover invokers #8993

merged 1 commit into from
Mar 14, 2023

Conversation

annevk
Copy link
Member

@annevk annevk commented Mar 8, 2023

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 )

They need to look within the current tree, not document. There's also no need for an HTMLCollection.

Tests: ?

Fixes #8989.
@annevk annevk added needs tests Moving the issue forward requires someone to write tests topic: popover The popover attribute and friends labels Mar 8, 2023
Copy link
Collaborator

@mfreed7 mfreed7 left a 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.

@annevk
Copy link
Member Author

annevk commented Mar 9, 2023

@mfreed7 this is a normative change. Root vs document is not the same when shadow trees are involved. Do we have tests for this?

@mfreed7
Copy link
Collaborator

mfreed7 commented Mar 13, 2023

@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.

@annevk
Copy link
Member Author

annevk commented Mar 14, 2023

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.

chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Mar 14, 2023
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
@mfreed7
Copy link
Collaborator

mfreed7 commented Mar 14, 2023

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.)

Ok, sounds good, thanks.

Please add a WPT and then this can be merged.

web-platform-tests/wpt#38981

@annevk annevk merged commit dc81ba3 into main Mar 14, 2023
@annevk annevk deleted the annevk/popover-invokers branch March 14, 2023 15:26
@annevk annevk removed the needs tests Moving the issue forward requires someone to write tests label Mar 14, 2023
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Mar 16, 2023
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
aarongable pushed a commit to chromium/chromium that referenced this pull request Mar 17, 2023
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}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Mar 17, 2023
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}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Mar 17, 2023
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}
cookiecrook pushed a commit to cookiecrook/wpt that referenced this pull request Mar 21, 2023
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}
marcoscaceres pushed a commit to web-platform-tests/wpt that referenced this pull request Mar 28, 2023
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}
cookiecrook pushed a commit to cookiecrook/wpt that referenced this pull request Mar 29, 2023
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}
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Mar 30, 2023
… 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
cookiecrook pushed a commit to cookiecrook/wpt that referenced this pull request Apr 8, 2023
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}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: popover The popover attribute and friends
Development

Successfully merging this pull request may close these issues.

Get the popover invokers algorithm looks incomplete/inaccurate
3 participants