瀏覽代碼

ComposeArea: Fix focussing

Always focus through `composeArea.focus()`, to ensure that the selection
range is correctly restored.
Danilo Bargen 6 年之前
父節點
當前提交
d9b2de8172
共有 1 個文件被更改,包括 3 次插入5 次删除
  1. 3 5
      src/directives/compose_area.ts

+ 3 - 5
src/directives/compose_area.ts

@@ -507,10 +507,8 @@ export default [
                     allEmoji.on('click', onEmojiChosen);
                     allEmojiTabs.on('keydown', onEmojiTabSelected);
 
-                    // set focus to fix chat scroll bug
-                    $timeout(() => {
-                        composeDiv[0].focus();
-                    });
+                    // Focus compose area again
+                    $timeout(() => composeArea.focus());
                 }
 
                 // Hide emoji picker element
@@ -665,7 +663,7 @@ export default [
                 // Listen to broadcasts
                 const unsubscribeListeners = [];
                 unsubscribeListeners.push($rootScope.$on('onQuoted', (event: ng.IAngularEvent, args: any) => {
-                    composeDiv[0].focus();
+                    composeArea.focus();
                 }));
 
                 // When switching chat, send stopTyping message