From 54d1224a52e652782232ea135a09ad1e4fac665a Mon Sep 17 00:00:00 2001 From: JonathanTGold <62672270+JonathanTGold@users.noreply.github.com> Date: Thu, 14 Oct 2021 18:11:14 +0300 Subject: [PATCH] fix(FEC-11520): Multi dropdowns are openable in cvaa overlay (#638) issue: the stop propagation (on dropdown click event) prevent the close menus logic handler (which trigerd by docoment click listener) to be trigerd. fix: remove the stop propagation and and move the dropdown opening action to the next event loop so that is would bot be canceled by on close logic sovles: FEC-11520 --- src/components/dropdown/dropdown.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/components/dropdown/dropdown.js b/src/components/dropdown/dropdown.js index 1f1c8d125..87c915ceb 100644 --- a/src/components/dropdown/dropdown.js +++ b/src/components/dropdown/dropdown.js @@ -77,13 +77,14 @@ class DropDown extends Component { /** * on click handler * - * @param {Event} e - keyboard event * @returns {void} * @memberof DropDown */ - onClick = (e: Event): void => { - e.stopPropagation(); - this.toggleDropDown(); + onClick = (): void => { + if (!this.state.dropMenuActive) { + // Prevents the menu from closing again by the handleClickOutside event (in the menu component) + setTimeout(() => this.toggleDropDown()); + } }; /** @@ -96,7 +97,7 @@ class DropDown extends Component { onKeyDown = (e: KeyboardEvent): void => { switch (e.keyCode) { case KeyMap.ENTER: - this.onClick(e); + this.onClick(); break; case KeyMap.ESC: if (this.state.dropMenuActive) {