UX: disable scrolling when modal is open on desktop (#30035)
Uses the `htmlClass` to automagically set the `modal-open` class to `<html>` so that we can do `overflow: hidden` and prevent the "background" behind the modal from scrolling while the modal is open. Internal ref - t/142760
This commit is contained in:
parent
5d5f9ecfb9
commit
ab32623c07
|
@ -12,6 +12,7 @@ import DButton from "discourse/components/d-button";
|
||||||
import FlashMessage from "discourse/components/flash-message";
|
import FlashMessage from "discourse/components/flash-message";
|
||||||
import concatClass from "discourse/helpers/concat-class";
|
import concatClass from "discourse/helpers/concat-class";
|
||||||
import element from "discourse/helpers/element";
|
import element from "discourse/helpers/element";
|
||||||
|
import htmlClass from "discourse/helpers/html-class";
|
||||||
import {
|
import {
|
||||||
disableBodyScroll,
|
disableBodyScroll,
|
||||||
enableBodyScroll,
|
enableBodyScroll,
|
||||||
|
@ -261,6 +262,7 @@ export default class DModal extends Component {
|
||||||
@inline={{@inline}}
|
@inline={{@inline}}
|
||||||
@append={{true}}
|
@append={{true}}
|
||||||
>
|
>
|
||||||
|
{{htmlClass "modal-open"}}
|
||||||
<this.dynamicElement
|
<this.dynamicElement
|
||||||
class={{concatClass
|
class={{concatClass
|
||||||
"modal"
|
"modal"
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
html.modal-open {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
.d-modal {
|
.d-modal {
|
||||||
--modal-max-width: 600px;
|
--modal-max-width: 600px;
|
||||||
--modal-width: 30em; // set in ems to scale with user font-size
|
--modal-width: 30em; // set in ems to scale with user font-size
|
||||||
|
|
Loading…
Reference in New Issue