about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/features/composer/textarea/suggestions
diff options
context:
space:
mode:
authorkibigo! <marrus-sh@users.noreply.github.com>2018-01-05 20:04:13 -0800
committerkibigo! <marrus-sh@users.noreply.github.com>2018-01-05 20:43:16 -0800
commitad10a80a9925c247ef14837d3a14ff7e7375f001 (patch)
tree6af7809a0a3c0c043e496274711c912bbf9acf98 /app/javascript/flavours/glitch/features/composer/textarea/suggestions
parent8bf9d9362a4eeb774d849887c1645b3175d73828 (diff)
Styling and autosuggest fixes for #293
Diffstat (limited to 'app/javascript/flavours/glitch/features/composer/textarea/suggestions')
-rw-r--r--app/javascript/flavours/glitch/features/composer/textarea/suggestions/item/index.js15
1 files changed, 13 insertions, 2 deletions
diff --git a/app/javascript/flavours/glitch/features/composer/textarea/suggestions/item/index.js b/app/javascript/flavours/glitch/features/composer/textarea/suggestions/item/index.js
index d2c794ae9..f55640bcf 100644
--- a/app/javascript/flavours/glitch/features/composer/textarea/suggestions/item/index.js
+++ b/app/javascript/flavours/glitch/features/composer/textarea/suggestions/item/index.js
@@ -24,9 +24,16 @@ const handlers = {
     } = this.props;
     if (onClick) {
       e.preventDefault();
+      e.stopPropagation();  //  Prevents following account links
       onClick(index);
     }
   },
+
+  //  This prevents the focus from changing, which would mess with
+  //  our suggestion code.
+  handleMouseDown (e) {
+    e.preventDefault();
+  },
 };
 
 //  The component.
@@ -40,7 +47,10 @@ export default class ComposerTextareaSuggestionsItem extends React.Component {
 
   //  Rendering.
   render () {
-    const { handleClick } = this.handlers;
+    const {
+      handleMouseDown,
+      handleClick,
+    } = this.handlers;
     const {
       selected,
       suggestion,
@@ -51,7 +61,8 @@ export default class ComposerTextareaSuggestionsItem extends React.Component {
     return (
       <div
         className={computedClass}
-        onMouseDown={handleClick}
+        onMouseDown={handleMouseDown}
+        onClickCapture={handleClick}  //  Jumps in front of contents
         role='button'
         tabIndex='0'
       >