From 262685aa7ad957bd8c59530b3a4e344ae40ac6e7 Mon Sep 17 00:00:00 2001 From: Kurt Hoyt Date: Tue, 12 Dec 2017 16:45:31 -0500 Subject: [PATCH 1/2] Fix an issue introduced by commit f6920de that results in multiple dropdowns being open at the same time because stopping propagation of the arrow mouse down event in select 2 when opening its dropdown does not allow the blur event to happen for select 1, so the dropdown for select 1 remains open. --- src/Select.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/Select.js b/src/Select.js index b4931cd82e..9dedbeff79 100644 --- a/src/Select.js +++ b/src/Select.js @@ -285,19 +285,20 @@ class Select extends React.Component { if (this.props.disabled || (event.type === 'mousedown' && event.button !== 0)) { return; } - // If the menu isn't open, let the event bubble to the main handleMouseDown - if (!this.state.isOpen) { + + if (this.state.isOpen) { + // prevent default event handlers + event.stopPropagation(); + event.preventDefault(); + // close the menu + this.closeMenu(); + } + else { + // If the menu isn't open, let the event bubble to the main handleMouseDown this.setState({ isOpen: true, }); } - // prevent default event handlers - event.stopPropagation(); - event.preventDefault(); - // close the menu - if(this.state.isOpen){ - this.closeMenu(); - } } handleMouseDownOnMenu (event) { From 785358150402d76ae29ee2f8977571b0dc2368cd Mon Sep 17 00:00:00 2001 From: Kurt Hoyt Date: Tue, 12 Dec 2017 16:46:00 -0500 Subject: [PATCH 2/2] Match the else coding style to the project. --- src/Select.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Select.js b/src/Select.js index 9dedbeff79..cfc4bcddbb 100644 --- a/src/Select.js +++ b/src/Select.js @@ -292,8 +292,7 @@ class Select extends React.Component { event.preventDefault(); // close the menu this.closeMenu(); - } - else { + } else { // If the menu isn't open, let the event bubble to the main handleMouseDown this.setState({ isOpen: true,