Skip to content

Commit

Permalink
Add initiallyopen attribute to the <popup> element
Browse files Browse the repository at this point in the history
This add an attribute called initiallyopen to the <popup> element.
When this attribute is present on page load, the first such element
will be shown by default.

See [1] for the conversation and Open-UI resolution.

This CL also re-points the explainer links for all popup tests
to the new Open-UI repo.

[1] openui/open-ui#311 (comment)

Bug: 1168738
Change-Id: Ib95d12234f359d503dc168e6799dd2a17b0dc18e
  • Loading branch information
mfreed7 authored and chromium-wpt-export-bot committed Apr 18, 2021
1 parent d563ea8 commit 5b4c45c
Show file tree
Hide file tree
Showing 14 changed files with 90 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<meta charset="utf-8" />
<title>Popup anchor nesting</title>
<link rel="author" href="mailto:[email protected]">
<link rel=help href="https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/Popup/explainer.md">
<link rel=help href="https://open-ui.org/components/popup.research.explainer">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="author" href="mailto:[email protected]">
<link rel=help href="https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/Popup/explainer.md">
<link rel=help href="https://open-ui.org/components/popup.research.explainer">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<meta charset="utf-8">
<link rel=author href="mailto:[email protected]">
<link rel=help href="https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/Popup/explainer.md">
<link rel=help href="https://open-ui.org/components/popup.research.explainer">
<link rel=match href="popup-hidden-display-ref.tentative.html">

No popup should be displayed here.<p>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<meta charset="utf-8">
<link rel=author href="mailto:[email protected]">

<div>This is a popup, which should be open upon load</div>

<style>
div {
/* Per spec: */
display: block;
position: fixed;
top: 0;
left: 0;
/* Per settings in test file: */
width: fit-content;
height: fit-content;
border: 1px solid;
padding: 1em;
background: -internal-light-dark(white, black);
color: -internal-light-dark(black, white);
}
</style>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<meta charset="utf-8">
<link rel=author href="mailto:[email protected]">
<link rel=help href="https://open-ui.org/components/popup.research.explainer">
<link rel=match href="popup-initiallyopen-display-ref.tentative.html">

<popup id=p1 initiallyopen>This is a popup, which should be open upon load</popup>
<popup id=p2 initiallyopen>This is a second popup with initiallyopen, which should NOT be open upon load</popup>

<style>
popup {
width: fit-content;
height: fit-content;
border: 1px solid;
padding: 1em;
background: white;
color: black;
}
#p1 {
top:0;
}
#p2 {
top:100px;
}
</style>

Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!DOCTYPE html>
<meta charset="utf-8">
<link rel=author href="mailto:[email protected]">
<link rel=help href="https://open-ui.org/components/popup.research.explainer">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<popup id=p1 initiallyopen>This is a popup, which should be open upon load</popup>
<popup id=p2 initiallyopen>This is a second popup with initiallyopen, which should NOT be open upon load</popup>
<popup id=p3>Also not visible</popup>

<script>
test(function(){
assert_true(p1.open,'initiallyopen should open the popup');
assert_true(p1.hasAttribute('initiallyopen'));
assert_true(p1.initiallyOpen,'initiallyopen should be reflected in the IDL attribute');
assert_false(p2.open, 'Only the first popup with initiallyopen should be open on load');
assert_true(p2.hasAttribute('initiallyopen'),'initiallyopen should be present/true, even if not opened');
assert_true(p2.initiallyOpen,'initiallyopen should be present/true, even if not opened');

assert_false(p3.open);
p3.setAttribute('initiallyopen','');
assert_false(p3.open, 'Changing initiallyopen should not affect open status');
assert_true(p3.hasAttribute('initiallyopen'));
assert_true(p3.initiallyOpen,'initiallyopen should still reflect to IDL');

p1.removeAttribute('initiallyopen');
assert_true(p1.open,'removing initiallyopen should not close the popup');
assert_false(p1.hasAttribute('initiallyopen'),'...but it should reflect to IDL');
}, "The initiallyopen attribute should affect page load only");
</script>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<meta charset="utf-8">
<link rel=author href="mailto:[email protected]">
<link rel=help href="https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/Popup/explainer.md">
<link rel=help href="https://open-ui.org/components/popup.research.explainer">
<link rel=match href="popup-hidden-display-ref.tentative.html">

No popup should be displayed here.<p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<meta charset="utf-8" />
<title>Popup invoking attribute</title>
<link rel="author" href="mailto:[email protected]">
<link rel=help href="https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/Popup/explainer.md">
<link rel=help href="https://open-ui.org/components/popup.research.explainer">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<meta charset="utf-8" />
<title>Popup light dismiss on scroll</title>
<link rel="author" href="mailto:[email protected]">
<link rel=help href="https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/Popup/explainer.md">
<link rel=help href="https://open-ui.org/components/popup.research.explainer">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<meta charset="utf-8" />
<title>Popup light dismiss behavior</title>
<link rel="author" href="mailto:[email protected]">
<link rel=help href="https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/Popup/explainer.md">
<link rel=help href="https://open-ui.org/components/popup.research.explainer">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<meta charset="utf-8">
<link rel=author href="mailto:[email protected]">
<link rel=help href="https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/Popup/explainer.md">
<link rel=help href="https://open-ui.org/components/popup.research.explainer">
<link rel=match href="popup-open-display-ref.tentative.html">

<popup>This is a popup</popup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<meta charset="utf-8">
<link rel=author href="mailto:[email protected]">
<link rel=help href="https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/Popup/explainer.md">
<link rel=help href="https://open-ui.org/components/popup.research.explainer">
<link rel=match href="popup-open-overflow-display-ref.tentative.html">

<div id=container>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="author" href="mailto:[email protected]">
<link rel=help href="https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/Popup/explainer.md">
<link rel=help href="https://open-ui.org/components/popup.research.explainer">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="author" href="mailto:[email protected]">
<link rel=help href="https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/Popup/explainer.md">
<link rel=help href="https://open-ui.org/components/popup.research.explainer">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

Expand Down

0 comments on commit 5b4c45c

Please sign in to comment.