Skip to content

Commit

Permalink
Switch to flat tree traversal for <popup> ancestral element search
Browse files Browse the repository at this point in the history
Previously, a light-DOM parent traversal was used, however, this was
already questionable, and it breaks the <selectmenu> use case. So I
think the right thing to do here is a flat tree traversal.

Bug: 1168738
Change-Id: I1008fed2a41d729c7dba79b878ed8f7845d95eb6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2893593
Auto-Submit: Mason Freed <masonf@chromium.org>
Commit-Queue: Ionel Popescu <iopopesc@microsoft.com>
Reviewed-by: Ionel Popescu <iopopesc@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#882861}
  • Loading branch information
Mason Freed authored and chromium-wpt-export-bot committed May 14, 2021
1 parent a6ae027 commit 0b4f125
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
<template shadowroot=open>
<button id=t3b1 onclick='showPopup("test3",0)'>Test 3 Popup 1</button>
<popup anchor=t3b1>
<p>This popup will be hidden when popup2 shows.</p>
<p>This popup will stay open when popup2 shows.</p>
<slot></slot>
</popup>
</template>
Expand All @@ -115,15 +115,17 @@
popup1.show();
assert_true(popup1.open);
assert_true(popupVisible(popup1));
// Showing popup2 will close popup1, since it is not a DOM
// Showing popup2 should not close popup1, since it is a flat
// tree ancestor of popup2's anchor button.
popup2.show();
assert_true(popup2.open);
assert_true(popupVisible(popup2));
assert_true(popup1.open);
assert_true(popupVisible(popup1));
popup1.hide();
assert_false(popup2.open);
assert_false(popup1.open);
assert_false(popupVisible(popup1));
popup2.hide();
}, "anchor references use the DOM tree not the flat tree");
}, "anchor references use the flat tree not the DOM tree");
</script>


Expand Down

0 comments on commit 0b4f125

Please sign in to comment.