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

Add <popup> light dismiss behavior when <popup> is resized #28963

Merged
merged 1 commit into from
May 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@
.pointerUp({button: actions.ButtonType.LEFT})
.send();
}
function eventLoop() {
return new Promise(resolve => setTimeout(resolve, 0));
}

const popup1 = document.querySelector('#p1');
const button1 = document.querySelector('#b1');
Expand Down Expand Up @@ -183,17 +186,27 @@
popup6.hide();
},'Scrolling within a popup should not close the popup');

popup1.show();
await eventLoop(); // Wait for initial resize observer to run
assert_true(popup1.open,'popup1 should be open');
popup1.style.width = "250px";
await eventLoop(); // Wait for style change resize to run
test(t => {
popup1.show();
assert_true(popup1.open,'popup1 should be open');
popup1.style.width = "100px";
assert_false(popup1.open,'popup1 should close when resized');
popup1.style.width = "";
popup1.show();
assert_true(popup1.open);
popup1.querySelector('span').textContent = "This is a test, which is longer than original";
},'Popup should be closed by an explicit resize of the popup');

popup1.show();
await eventLoop(); // Wait for initial resize observer to run
assert_true(popup1.open);
const popup1Text = popup1.querySelector('span');
const originalText = popup1Text.textContent;
popup1Text.textContent = "This is a test, which is longer than the original";
await eventLoop(); // Wait for style change resize to run
test(t => {
assert_false(popup1.open,'popup1 should close when text content forces its size to change');
},'Popup should be closed by a resize of the popup');
popup1Text.textContent = originalText;
},'Popup should be closed by an implicit resize of the popup');

done();
})();
Expand Down
1 change: 1 addition & 0 deletions lint.ignore
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ SET TIMEOUT: html/cross-origin-embedder-policy/credentialless/resources/dispatch
SET TIMEOUT: html/editing/dnd/*
SET TIMEOUT: html/semantics/embedded-content/the-iframe-element/*
SET TIMEOUT: html/semantics/embedded-content/the-img-element/*
SET TIMEOUT: html/semantics/interactive-elements/the-popup-element/popup-light-dismiss.tentative.html
SET TIMEOUT: html/semantics/scripting-1/the-script-element/*
SET TIMEOUT: html/webappapis/dynamic-markup-insertion/opening-the-input-stream/0*
SET TIMEOUT: html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/history-frame.html
Expand Down