From 43b8df3228291a879170be4da84db63eeacdf144 Mon Sep 17 00:00:00 2001 From: ThibG Date: Thu, 23 Aug 2018 20:43:27 +0200 Subject: [PATCH] Update state when opened dropdown is unmounted (fixes #8397) (#8398) --- app/javascript/mastodon/components/dropdown_menu.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/javascript/mastodon/components/dropdown_menu.js b/app/javascript/mastodon/components/dropdown_menu.js index e83f724e9e..a5cf6479b0 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;