mirror of
https://github.com/hunvreus/basecoat.git
synced 2026-11-11 04:38:18 +00:00
Lock page scroll while a modal dialog is open
Pure CSS: html:has(<dialog>:modal) gets overflow: hidden. A scroll timeline sets scrollbar-gutter: stable only when the page can scroll, so the layout doesn't shift.
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
|
||||
- Prevented Escape from dismissing an enclosing dialog while closing an open Combobox popup.
|
||||
- Fixed long Tooltip text clipping instead of showing an ellipsis across all style packs.
|
||||
- Locked page scroll while a modal Dialog, Alert Dialog, Command Dialog or Drawer is open.
|
||||
|
||||
## [1.0.2] - 2026-07-06
|
||||
|
||||
|
||||
@@ -1,5 +1,19 @@
|
||||
/* Dialog */
|
||||
@keyframes dialog-scroll-lock {
|
||||
from, to {
|
||||
scrollbar-gutter: stable;
|
||||
}
|
||||
}
|
||||
|
||||
@layer components {
|
||||
/* Lock page scroll while a modal dialog is open. The scroll timeline only
|
||||
reserves the scrollbar gutter if the page can scroll, so nothing shifts. */
|
||||
html:has(:is(.dialog, .alert-dialog, .command-dialog, .drawer):modal) {
|
||||
overflow: hidden;
|
||||
animation: dialog-scroll-lock linear both;
|
||||
animation-timeline: scroll(self);
|
||||
}
|
||||
|
||||
.dialog,
|
||||
.alert-dialog {
|
||||
@apply bg-transparent p-0 text-inherit opacity-0 transition-all transition-discrete backdrop:opacity-0 backdrop:transition-all backdrop:transition-discrete;
|
||||
|
||||
Reference in New Issue
Block a user