Skip to content

Commit

Permalink
fix(FEC-11520): Multi dropdowns are openable in cvaa overlay (#638)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
JonathanTGold authored Oct 14, 2021
1 parent 3b401fc commit 54d1224
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/components/dropdown/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
};

/**
Expand All @@ -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) {
Expand Down

0 comments on commit 54d1224

Please sign in to comment.