From 4f080dfd5667c9eb05fc2ce30d9ea3fd382393e6 Mon Sep 17 00:00:00 2001 From: Danae Millan Date: Tue, 13 Apr 2021 13:57:58 -0300 Subject: [PATCH] Prevent the clicks on the dropdown component from propagating --- packages/react-dropdown/lib/react-dropdown.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/react-dropdown/lib/react-dropdown.js b/packages/react-dropdown/lib/react-dropdown.js index f363c57b..144a3220 100644 --- a/packages/react-dropdown/lib/react-dropdown.js +++ b/packages/react-dropdown/lib/react-dropdown.js @@ -15,7 +15,8 @@ export class Dropdown extends Component { this.handleClickOutside = this.handleClickOutside.bind( this ); } - toggle() { + toggle( e ) { + e.stopPropagation(); this.setState({ open: !this.state.open }); @@ -97,7 +98,7 @@ export class Dropdown extends Component { ref={ this.setWrapperRef } icon="widget-settings-config" label={ open ? 'Open menu' : 'Close menu' } - onClick={ () => this.toggle() } + onClick={ ( e ) => this.toggle( e ) } /> { open && }