diff --git a/js/forum/src/components/EditPostComposer.js b/js/forum/src/components/EditPostComposer.js index 7f7c06778..90d0b6aa7 100644 --- a/js/forum/src/components/EditPostComposer.js +++ b/js/forum/src/components/EditPostComposer.js @@ -16,6 +16,14 @@ export default class EditPostComposer extends ComposerBody { super.init(); this.editor.props.preview = () => { + // If the composer backdrop is visible, assume we're on mobile and need to + // minimize the composer in order to see the preview. We do this as a + // timeout so that it occurs after the click handler on the composer + // itself that shows the composer if minimized. + if (app.composer.$backdrop.length) { + setTimeout(() => app.composer.minimize(), 0); + } + m.route(app.route.post(this.props.post)); }; } diff --git a/js/forum/src/components/ReplyComposer.js b/js/forum/src/components/ReplyComposer.js index fe6c3c8fe..38b67d746 100644 --- a/js/forum/src/components/ReplyComposer.js +++ b/js/forum/src/components/ReplyComposer.js @@ -18,6 +18,14 @@ export default class ReplyComposer extends ComposerBody { super.init(); this.editor.props.preview = () => { + // If the composer backdrop is visible, assume we're on mobile and need to + // minimize the composer in order to see the preview. We do this as a + // timeout so that it occurs after the click handler on the composer + // itself that shows the composer if minimized. + if (app.composer.$backdrop.length) { + setTimeout(() => app.composer.minimize(), 0); + } + m.route(app.route.discussion(this.props.discussion, 'reply')); }; }