FIX: Enable scroll events in modals for IOS (#29393)
This commit is contained in:
parent
ed40c8bfd0
commit
0983e73c2c
|
@ -19,6 +19,7 @@ import {
|
||||||
import { getMaxAnimationTimeMs } from "discourse/lib/swipe-events";
|
import { getMaxAnimationTimeMs } from "discourse/lib/swipe-events";
|
||||||
import swipe from "discourse/modifiers/swipe";
|
import swipe from "discourse/modifiers/swipe";
|
||||||
import trapTab from "discourse/modifiers/trap-tab";
|
import trapTab from "discourse/modifiers/trap-tab";
|
||||||
|
import { bind } from "discourse-common/utils/decorators";
|
||||||
|
|
||||||
export const CLOSE_INITIATED_BY_BUTTON = "initiatedByCloseButton";
|
export const CLOSE_INITIATED_BY_BUTTON = "initiatedByCloseButton";
|
||||||
export const CLOSE_INITIATED_BY_ESC = "initiatedByESC";
|
export const CLOSE_INITIATED_BY_ESC = "initiatedByESC";
|
||||||
|
@ -32,6 +33,7 @@ export default class DModal extends Component {
|
||||||
@service modal;
|
@service modal;
|
||||||
@service site;
|
@service site;
|
||||||
@service appEvents;
|
@service appEvents;
|
||||||
|
@service capabilities;
|
||||||
|
|
||||||
@tracked wrapperElement;
|
@tracked wrapperElement;
|
||||||
@tracked animating = false;
|
@tracked animating = false;
|
||||||
|
@ -59,6 +61,11 @@ export default class DModal extends Component {
|
||||||
this.handleDocumentKeydown
|
this.handleDocumentKeydown
|
||||||
);
|
);
|
||||||
|
|
||||||
|
this.appEvents.on(
|
||||||
|
"keyboard-visibility-change",
|
||||||
|
this.handleKeyboardVisibilityChange
|
||||||
|
);
|
||||||
|
|
||||||
if (this.site.mobileView) {
|
if (this.site.mobileView) {
|
||||||
this.animating = true;
|
this.animating = true;
|
||||||
|
|
||||||
|
@ -83,6 +90,11 @@ export default class DModal extends Component {
|
||||||
"keydown",
|
"keydown",
|
||||||
this.handleDocumentKeydown
|
this.handleDocumentKeydown
|
||||||
);
|
);
|
||||||
|
|
||||||
|
this.appEvents.off(
|
||||||
|
"keyboard-visibility-change",
|
||||||
|
this.handleKeyboardVisibilityChange
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
get dismissable() {
|
get dismissable() {
|
||||||
|
@ -209,6 +221,13 @@ export default class DModal extends Component {
|
||||||
return element(tagName);
|
return element(tagName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@bind
|
||||||
|
handleKeyboardVisibilityChange(visible) {
|
||||||
|
if (visible && this.capabilities.isIOS && !this.capabilities.isIpadOS) {
|
||||||
|
window.scrollTo(0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#animateBackdropOpacity(position) {
|
#animateBackdropOpacity(position) {
|
||||||
const backdrop = this.wrapperElement.nextElementSibling;
|
const backdrop = this.wrapperElement.nextElementSibling;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue