dialog-polyfill
dialog-polyfill copied to clipboard
Prevent page scrolling while modal dialog is open
When the dialog is open, notably in modal
mode, it is possible to still scroll the page behind of the dialog
.
The new and now fairly well supported overscroll-behavior
CSS property could be applied to the dialog
element in order to prevent scrolling of the page when the inside of the dialog is scrolled (overscroll-behavior: contain
).
However, it doesn't seem to work with the dialog
element, scrolling inside the dialog
will still scroll the page.