Skip to content

Commit

Permalink
Make showPicker() throw NotSupportedError if select isn't being rendered
Browse files Browse the repository at this point in the history
If the select element has no layout box throw the correct dom exception.

Bug: 1485010
Change-Id: I7824c4b904ed4677faec6200f56c8055fefcfcf9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5071276
Reviewed-by: Joey Arhar <[email protected]>
Commit-Queue: Luke <[email protected]>
Reviewed-by: Vladimir Levin <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1239446}
  • Loading branch information
lukewarlow authored and chromium-wpt-export-bot committed Dec 20, 2023
1 parent 3d2d5d5 commit 67141e8
Showing 1 changed file with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<title>Test showPicker() being rendered requirement with content-visibility</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<div style="content-visibility: hidden">
<select id="select">
<option>Item 1</option>
</select>
</div>
<script>
promise_test(async t => {
await test_driver.bless('show picker');
assert_throws_dom('NotSupportedError', () => { select.showPicker(); });

// Test that dynamically changing to actually being rendered works.
await test_driver.bless('show picker');
select.parentElement.style.contentVisibility = 'visible';
select.showPicker();
select.blur();
}, 'select showPicker() throws when content-visibility hidden');
</script>

0 comments on commit 67141e8

Please sign in to comment.