Last active
August 7, 2024 11:43
-
-
Save LukeberryPi/ea7eb3e954c182346a015f662ecc574f to your computer and use it in GitHub Desktop.
disable backdrop/background scroll when there is a modal/dialog open
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
/* | |
disable backdrop/background scroll when there is a modal/dialog open | |
this depends on having the open attribute on the dialog itself | |
more: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog | |
*/ | |
dialog::backdrop { overflow: hidden; } body:has(dialog[open]) { overflow: hidden; pointer-events: none; } dialog[open] { pointer-events: auto; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
disable backdrop/background scroll when there is a modal/dialog open