-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix backdrop color for <dialog popup>
When a `<dialog>` is opened via `.showPopUp()`, it should have a completely transparent ::backdrop. This CL fixes that by adding a special case for dialog::open. See also: openui/open-ui#561 (comment) Bug: 1307772 Change-Id: I444730c57c699f4af4a708cc316dd81aa7563669
- Loading branch information
1 parent
c5aa57c
commit 7167621
Showing
2 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
html/semantics/popups/popup-dialog-appearance-ref.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> | ||
<meta charset="utf-8" /> | ||
<title>Dialog-Popup appearance</title> | ||
<link rel="author" href="mailto:masonf@chromium.org"> | ||
|
||
<p>Both dialogs should have the same shades of background.</p> | ||
<p>The pop-up should have a completely-transparent ::backdrop.</p> | ||
<dialog popup id=d1>This is a modal dialog</dialog> | ||
<dialog popup id=d2>This is a dialog pop-up</dialog> | ||
|
||
<style> | ||
dialog { | ||
left: 50px; | ||
right: auto; | ||
bottom: auto; | ||
} | ||
#d1 {top:100px;} | ||
#d2 {top:150px;} | ||
/* Force backdrop to spec: */ | ||
#d1::backdrop { | ||
/* https://html.spec.whatwg.org/multipage/rendering.html#flow-content-3 */ | ||
background-color: rgba(0, 0, 0, 0.1); | ||
} | ||
#d2::backdrop { | ||
/* When shown as a pop-up, backdrop must be transparent */ | ||
background-color: transparent; | ||
} | ||
</style> | ||
|
||
<script> | ||
document.getElementById('d1').showModal(); | ||
document.getElementById('d2').showPopUp(); | ||
</script> |
26 changes: 26 additions & 0 deletions
26
html/semantics/popups/popup-dialog-appearance.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,26 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8" /> | ||
<title>Dialog-Popup appearance</title> | ||
<link rel="author" href="mailto:masonf@chromium.org"> | ||
<link rel=help href="https://open-ui.org/components/popup.research.explainer"> | ||
<link rel="match" href="popup-dialog-appearance-ref.tentative.html"> | ||
|
||
<p>Both dialogs should have the same shades of background.</p> | ||
<p>The pop-up should have a completely-transparent ::backdrop.</p> | ||
<dialog popup id=d1>This is a modal dialog</dialog> | ||
<dialog popup id=d2>This is a dialog pop-up</dialog> | ||
|
||
<style> | ||
dialog { | ||
left: 50px; | ||
right: auto; | ||
bottom: auto; | ||
} | ||
#d1 {top:100px;} | ||
#d2 {top:150px;} | ||
</style> | ||
|
||
<script> | ||
document.getElementById('d1').showModal(); | ||
document.getElementById('d2').showPopUp(); | ||
</script> |