about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/components
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2018-08-23 22:14:30 +0200
committerThibG <thib@sitedethib.com>2018-08-23 22:58:14 +0200
commitfce248810b74fec717b37a06217da84933fde471 (patch)
tree58e7d0760150e7ef3239e7a3ae4169ff8f064d08 /app/javascript/flavours/glitch/components
parent8aa58e34bb2b62192a997ac7ea8919b22fc45f80 (diff)
[Glitch] Update state when opened dropdown is unmounted
Port dcd3544d153dd2a3961bd0d2214ed01a902a66da to glitch-soc
Diffstat (limited to 'app/javascript/flavours/glitch/components')
-rw-r--r--app/javascript/flavours/glitch/components/dropdown_menu.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/javascript/flavours/glitch/components/dropdown_menu.js b/app/javascript/flavours/glitch/components/dropdown_menu.js
index 27b2586e5..1c2b0bf25 100644
--- a/app/javascript/flavours/glitch/components/dropdown_menu.js
+++ b/app/javascript/flavours/glitch/components/dropdown_menu.js
@@ -225,6 +225,12 @@ export default class Dropdown extends React.PureComponent {
     return this.target;
   }
 
+  componentWillUnmount = () => {
+    if (this.state.id === this.props.openDropdownId) {
+      this.handleClose();
+    }
+  }
+
   render () {
     const { icon, items, size, ariaLabel, disabled, dropdownPlacement, openDropdownId } = this.props;
     const open = this.state.id === openDropdownId;