about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2019-09-17 23:40:06 +0200
committerThibG <thib@sitedethib.com>2019-09-18 00:11:03 +0200
commitab646fac5f582fe9bef22d8b9a4995fbb4b42d7d (patch)
treef2a3851c9909f100b75c139aab494a493fdff81f /app
parent591185344e3a4277989c67a15174aa7b9d7d7aa0 (diff)
Fix composer dropdown toggle buttons (threaded mode and local-only) not working
Diffstat (limited to 'app')
-rw-r--r--app/javascript/flavours/glitch/features/compose/components/dropdown_menu.js13
1 files changed, 5 insertions, 8 deletions
diff --git a/app/javascript/flavours/glitch/features/compose/components/dropdown_menu.js b/app/javascript/flavours/glitch/features/compose/components/dropdown_menu.js
index 60fee9b7f..404504e84 100644
--- a/app/javascript/flavours/glitch/features/compose/components/dropdown_menu.js
+++ b/app/javascript/flavours/glitch/features/compose/components/dropdown_menu.js
@@ -77,9 +77,7 @@ export default class ComposerOptionsDropdownContent extends React.PureComponent
     document.removeEventListener('touchend', this.handleDocumentClick, withPassive);
   }
 
-  handleClick = (e) => {
-    const name = e.currentTarget.getAttribute('data-index');
-
+  handleClick = (name, e) => {
     const {
       onChange,
       onClose,
@@ -103,9 +101,8 @@ export default class ComposerOptionsDropdownContent extends React.PureComponent
     }
   }
 
-  handleKeyDown = e => {
+  handleKeyDown = (name, e) => {
     const { items } = this.props;
-    const name = e.currentTarget.getAttribute('data-index');
     const index = items.findIndex(item => {
       return (item.name === name);
     });
@@ -183,7 +180,7 @@ export default class ComposerOptionsDropdownContent extends React.PureComponent
     let prefix = null;
 
     if (on !== null && typeof on !== 'undefined') {
-      prefix = <Toggle checked={on} onChange={this.handleClick} />;
+      prefix = <Toggle checked={on} onChange={this.handleClick.bind(this, name)} />;
     } else if (icon) {
       prefix = <Icon className='icon' fixedWidth id={icon} />
     }
@@ -191,8 +188,8 @@ export default class ComposerOptionsDropdownContent extends React.PureComponent
     return (
       <div
         className={computedClass}
-        onClick={this.handleClick}
-        onKeyDown={this.handleKeyDown}
+        onClick={this.handleClick.bind(this, name)}
+        onKeyDown={this.handleKeyDown.bind(this, name)}
         role='option'
         tabIndex='0'
         key={name}