Skip to content

Commit

Permalink
fix(FEC-9746): menu bar buttons ignores clicking if another menu is o…
Browse files Browse the repository at this point in the history
…pen (#484)

The main fix is removing event.stopPropagation from line 120 in menu.js.
Removed the useCapture true in the addEventListener and replaced it with eventManager listen
Removed redundant code in settings.js and language.js
  • Loading branch information
RoyBregman committed Feb 16, 2020
1 parent 6ece305 commit ba42283
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 18 deletions.
3 changes: 0 additions & 3 deletions src/components/language/language.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,6 @@ class Language extends Component {
!this.state.cvaaOverlay &&
!this.props.isSmallSize
) {
if (e.target.classList.contains('overlay-action')) {
e.stopPropagation();
}
this.setState({smartContainerOpen: false});
}
}
Expand Down
14 changes: 2 additions & 12 deletions src/components/menu/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,22 +64,13 @@ class Menu extends Component {
* @memberof Menu
*/
componentDidMount() {
document.addEventListener('click', this.handleClickOutside, true);
this.props.eventManager.listen(document, 'click', this.handleClickOutside);

if (!this.props.isMobile && !this.props.isSmallSize) {
this.setState({position: this.getPosition()});
}
}

/**
* before component unmount, remove the event listener
*
* @returns {void}
* @memberof Menu
*/
componentWillUnmount() {
document.removeEventListener('click', this.handleClickOutside);
}

/**
* get menu position based on document boundaries
*
Expand Down Expand Up @@ -117,7 +108,6 @@ class Menu extends Component {
handleClickOutside(e: any) {
if (!this.props.isMobile && !this.props.isSmallSize && this._menuElement && !this._menuElement.contains(e.target)) {
this.props.onClose();
e.stopPropagation();
}
}

Expand Down
3 changes: 0 additions & 3 deletions src/components/settings/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,6 @@ class Settings extends Component {
!this._controlSettingsElement.contains(e.target) &&
this.state.smartContainerOpen
) {
if (e.target.classList.contains(style.overlayPlay)) {
e.stopPropagation();
}
this.setState({smartContainerOpen: false});
}
}
Expand Down

0 comments on commit ba42283

Please sign in to comment.