-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add invalidation to select:open when datalist popover toggles
This patch makes select:open selectors get updated when the select is toggled open or closed due to popover triggering code. Without this, appearance:base-select <select>s might have styles applies for the closed state when they are open or vice versa. Bug: 40146374 Change-Id: If955675abf45a059f23cd005111152e72e1e5cda Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5545431 Reviewed-by: David Baron <dbaron@chromium.org> Commit-Queue: Joey Arhar <jarhar@chromium.org> Cr-Commit-Position: refs/heads/main@{#1303858}
- Loading branch information
1 parent
aeced2f
commit 089ad58
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
html/semantics/forms/the-select-element/stylable-select/select-open-invalidation-ref.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<!DOCTYPE html> | ||
<link rel=stylesheet href="resources/stylable-select-styles.css"> | ||
|
||
<style> | ||
button { | ||
color: green; | ||
} | ||
</style> | ||
|
||
<div id=container class=stylable-select-container> | ||
<button>button</button> | ||
<div id=popover popover=auto anchor=container class=stylable-select-datalist> | ||
<div tabindex=0 class=stylable-select-option>one</div> | ||
<div class=stylable-select-option>two</div> | ||
</div> | ||
</div> | ||
|
||
<script> | ||
document.getElementById('popover').showPopover(); | ||
document.querySelector('.stylable-select-option').focus(); | ||
</script> |
33 changes: 33 additions & 0 deletions
33
...emantics/forms/the-select-element/stylable-select/select-open-invalidation.tentative.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<!DOCTYPE html> | ||
<html class=reftest-wait> | ||
<link rel=author href="mailto:jarhar@chromium.org"> | ||
<link rel=help href="https://github.com/whatwg/html/issues/9799"> | ||
<link rel=match href="select-open-invalidation-ref.html"> | ||
|
||
<style> | ||
select > button { | ||
color: red; | ||
} | ||
select:open > button { | ||
color: green; | ||
} | ||
</style> | ||
|
||
<select style="appearance:base-select"> | ||
<button type=popover>button</button> | ||
<datalist> | ||
<option>one</option> | ||
<option>two</option> | ||
</datalist> | ||
</select> | ||
|
||
<script> | ||
(async () => { | ||
await new Promise(requestAnimationFrame); | ||
try { | ||
document.querySelector('datalist').showPopover(); | ||
} catch (error) {} | ||
await new Promise(requestAnimationFrame); | ||
document.documentElement.classList.remove('reftest-wait'); | ||
})(); | ||
</script> |