From 9fdafcc0148472118c37369fed4a9870acb9e66c Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Tue, 19 May 2015 09:17:44 +0930 Subject: [PATCH] Disable composer textarea before it has fully slid up Prevents early focusing of the textarea while it is still off the edge of the viewport, which was causing scroll position to jump --- framework/core/js/forum/src/components/composer-body.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/framework/core/js/forum/src/components/composer-body.js b/framework/core/js/forum/src/components/composer-body.js index 5b81d7a59..192428e93 100644 --- a/framework/core/js/forum/src/components/composer-body.js +++ b/framework/core/js/forum/src/components/composer-body.js @@ -10,6 +10,7 @@ export default class ComposerBody extends Component { this.loading = m.prop(false); this.disabled = m.prop(false); + this.ready = m.prop(false); this.content = m.prop(this.props.originalContent); this.editor = new TextEditor({ submitLabel: this.props.submitLabel, @@ -22,6 +23,8 @@ export default class ComposerBody extends Component { } view(className) { + this.editor.props.disabled = this.loading() || !this.ready(); + return m('div', {className, config: this.onload.bind(this)}, [ avatar(this.props.user, {className: 'composer-avatar'}), m('div.composer-body', [ @@ -37,6 +40,9 @@ export default class ComposerBody extends Component { } focus() { + this.ready(true); + m.redraw(); + var $input = this.$().find(':input:enabled:visible:first'); if ($input.length) { $input.focus();