FIX: Wait for CSS transition to end before attempting to focus.

https://meta.discourse.org/t/tab-should-work-after-edit-title-or-using-hotkeys/65792
This commit is contained in:
Guo Xiang Tan 2017-07-11 15:26:27 +09:00
parent 3ff9133f85
commit 31932813b7
1 changed files with 6 additions and 1 deletions

View File

@ -2,6 +2,7 @@ import { default as computed, observes } from 'ember-addons/ember-computed-decor
import InputValidation from 'discourse/models/input-validation';
import { load, lookupCache } from 'pretty-text/oneboxer';
import { ajax } from 'discourse/lib/ajax';
import afterTransition from 'discourse/lib/after-transition';
export default Ember.Component.extend({
classNames: ['title-input'],
@ -10,7 +11,11 @@ export default Ember.Component.extend({
didInsertElement() {
this._super();
if (this.get('focusTarget') === 'title') {
this.$('input').putCursorAtEnd();
const $input = this.$("input");
afterTransition(this.$().closest("#reply-control"), () => {
$input.putCursorAtEnd();
});
}
},