about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2018-08-23 20:43:27 +0200
committerEugen Rochko <eugen@zeonfederated.com>2018-08-23 20:43:27 +0200
commit43b8df3228291a879170be4da84db63eeacdf144 (patch)
treec8bda26343dc78a82030917dbabb17b01f47e909 /app
parent5b5ae018241441192f2a83284856133299f57388 (diff)
Update state when opened dropdown is unmounted (fixes #8397) (#8398)
Diffstat (limited to 'app')
-rw-r--r--app/javascript/mastodon/components/dropdown_menu.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/javascript/mastodon/components/dropdown_menu.js b/app/javascript/mastodon/components/dropdown_menu.js
index e83f724e9..a5cf6479b 100644
--- a/app/javascript/mastodon/components/dropdown_menu.js
+++ b/app/javascript/mastodon/components/dropdown_menu.js
@@ -226,6 +226,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, title, disabled, dropdownPlacement, openDropdownId } = this.props;
     const open = this.state.id === openDropdownId;