Skip to content

Commit

Permalink
Make dialog user-agent styles apply while in top layer
Browse files Browse the repository at this point in the history
This makes it so that while the dialog element is doing an exit
animation, its positioning etc. styles from the user-agent stylesheet
still apply so it doesnt jump to a different spot while animating out.
The :modal class is removed during this time which is why it was a
problem before. We also can't just make all dialog elements always have
these styles applied, because then they would also apply to non-modal
dialogs.

Spec: whatwg/html#9387

Fixed: 1451910
Change-Id: I4d2b240ab17879d6cf08f94f32d7c7577e9f53ea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4739784
Commit-Queue: Joey Arhar <[email protected]>
Reviewed-by: Mason Freed <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1179848}
  • Loading branch information
josepharhar authored and chromium-wpt-export-bot committed Aug 4, 2023
1 parent 60116a4 commit d315170
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
6 changes: 6 additions & 0 deletions css/css-position/overlay/overlay-transition-dialog-ref.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<!DOCTYPE html>
<dialog>dialog</dialog>
<script>
document.querySelector('dialog').showModal();
document.activeElement.blur();
</script>
27 changes: 27 additions & 0 deletions css/css-position/overlay/overlay-transition-dialog.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html class=reftest-wait>
<link rel=author href="mailto:[email protected]">
<link rel=help href="https://drafts.csswg.org/css-position-4/#overlay">
<link rel=help href="https://bugs.chromium.org/p/chromium/issues/detail?id=1451910">
<link rel=help href="https://github.com/whatwg/html/pull/9387">
<link rel=match href="overlay-transition-dialog-ref.html">

<dialog>dialog</dialog>

<style>
dialog.animate {
transition: overlay 2s allow-discrete, display 2s allow-discrete;
}
</style>

<script>
const dialog = document.querySelector('dialog');
dialog.showModal();
dialog.classList.add('animate');
dialog.close();
requestAnimationFrame(() => {
requestAnimationFrame(() => {
document.documentElement.classList.remove('reftest-wait');
});
});
</script>

0 comments on commit d315170

Please sign in to comment.