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

[SelectMenu] Allow <option> to render arbitrary content when it is a descendant of <selectmenu>. #28377

Merged
merged 1 commit into from Apr 7, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="author" title="Ionel Popescu" href="mailto:iopopesc@microsoft.com">

<div>
option with image displayed
<img src="support/cat.png" alt="Image download support must be enabled" />
</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>
@@ -0,0 +1,52 @@
<!DOCTYPE html>
<html class="reftest-wait">
<title>HTMLSelectMenuElement Test: option arbitrary content displayed</title>
<link rel="author" title="Ionel Popescu" href="mailto:iopopesc@microsoft.com">
<link rel=match href="selectmenu-option-arbitrary-content-displayed-ref.tentative.html">
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-actions.js"></script>
<script src="/resources/testdriver-vendor.js"></script>

<style>
popup {
width: fit-content;
height: fit-content;
border: 1px solid;
padding: 1em;
background: white;
color: black;
}

option {
background-color: white !important;
padding: 0px;
}
</style>

<selectmenu id="selectMenu0">
<popup slot="listbox" part="listbox">
<option>
option with image displayed
<img src="support/cat.png" alt="Image download support must be enabled" />
</option>
</popup>
</selectmenu>

<script>
function clickOn(element) {
const actions = new test_driver.Actions();
return actions.pointerMove(0, 0, {origin: element})
.pointerDown({button: actions.ButtonType.LEFT})
.pointerUp({button: actions.ButtonType.LEFT})
.send();
}

async function test() {
const selectMenu0 = document.getElementById("selectMenu0");

await clickOn(selectMenu0);
document.documentElement.classList.remove('reftest-wait');
}

test();
</script>
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="author" title="Ionel Popescu" href="mailto:iopopesc@microsoft.com">

<option>
option with image not displayed
</option>

<selectmenu>
</selectmenu>

<option>
option with image not displayed
</option>
@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<title>HTMLSelectMenuElement Test: option arbitrary content not displayed</title>
<link rel="author" title="Ionel Popescu" href="mailto:iopopesc@microsoft.com">
<link rel=match href="selectmenu-option-arbitrary-content-not-displayed-ref.tentative.html">
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-actions.js"></script>
<script src="/resources/testdriver-vendor.js"></script>

<option>
option with image not displayed
<img src="support/cat.png" alt="Image download support must be enabled" />
</option>

<selectmenu id="selectMenu0">
<option id="selectMenu0-option">
option with image not displayed
<img src="support/cat.png" alt="Image download support must be enabled" />
</option>
</selectmenu>

<script>
const selectMenu0Option = document.getElementById("selectMenu0-option");

// removing an option from <selectmenu> should revert back to its original display behavior
selectMenu0Option.remove();
document.body.append(selectMenu0Option);
</script>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.