mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 12:12:26 +08:00
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 swipe from "discourse/modifiers/swipe";
|
||||
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_ESC = "initiatedByESC";
|
||||
|
@ -32,6 +33,7 @@ export default class DModal extends Component {
|
|||
@service modal;
|
||||
@service site;
|
||||
@service appEvents;
|
||||
@service capabilities;
|
||||
|
||||
@tracked wrapperElement;
|
||||
@tracked animating = false;
|
||||
|
@ -59,6 +61,11 @@ export default class DModal extends Component {
|
|||
this.handleDocumentKeydown
|
||||
);
|
||||
|
||||
this.appEvents.on(
|
||||
"keyboard-visibility-change",
|
||||
this.handleKeyboardVisibilityChange
|
||||
);
|
||||
|
||||
if (this.site.mobileView) {
|
||||
this.animating = true;
|
||||
|
||||
|
@ -83,6 +90,11 @@ export default class DModal extends Component {
|
|||
"keydown",
|
||||
this.handleDocumentKeydown
|
||||
);
|
||||
|
||||
this.appEvents.off(
|
||||
"keyboard-visibility-change",
|
||||
this.handleKeyboardVisibilityChange
|
||||
);
|
||||
}
|
||||
|
||||
get dismissable() {
|
||||
|
@ -209,6 +221,13 @@ export default class DModal extends Component {
|
|||
return element(tagName);
|
||||
}
|
||||
|
||||
@bind
|
||||
handleKeyboardVisibilityChange(visible) {
|
||||
if (visible && this.capabilities.isIOS && !this.capabilities.isIpadOS) {
|
||||
window.scrollTo(0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
#animateBackdropOpacity(position) {
|
||||
const backdrop = this.wrapperElement.nextElementSibling;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user