Skip to content

Commit

Permalink
fix(FEC-6914): open menu while other menu open (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dvir Hazout authored and Dan Ziv committed Sep 11, 2017
1 parent 163696d commit 56e9d86
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
8 changes: 5 additions & 3 deletions src/components/language/language.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,21 @@ class LanguageControl extends BaseComponent {
/**
* event listener for clicking outside handler.
*
* @param {Event} e - click event
* @param {*} e - click event
* @returns {void}
* @memberof LanguageControl
*/
handleClickOutside(e: Event): void {
handleClickOutside(e: any): void {
if (
this._controlLanguageElement &&
!this.props.isMobile &&
!this._controlLanguageElement.contains(event.target) &&
this.state.smartContainerOpen &&
!this.state.cvaaOverlay
) {
e.stopPropagation();
if (e.target.classList.contains('overlay-play')) {
e.stopPropagation();
}
this.setState({smartContainerOpen: false});
}
}
Expand Down
9 changes: 6 additions & 3 deletions src/components/menu/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,16 @@ class Menu extends Component {
* handler to click outside of the component event listener.
* if not mobile device and clicked outside the component, call the onClose callback
*
* @param {Event} e click event
* @param {*} e click event
* @returns {void}
* @memberof Menu
*/
handleClickOutside(e: Event) {
handleClickOutside(e: any) {
if (!this.props.isMobile && this._menuElement && !this._menuElement.contains(event.target)) {
e.stopPropagation();

if (e.target.classList.contains('overlay-play') || e.target.parentElement.getElementsByClassName('dropdown-menu')[0] === this._menuElement) {
e.stopPropagation();
}
this.props.onClose();
}
}
Expand Down
8 changes: 5 additions & 3 deletions src/components/settings/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,15 @@ class SettingsControl extends BaseComponent {
/**
* event listener for clicking outside handler.
*
* @param {Event} e - click event
* @param {*} e - click event
* @returns {void}
* @memberof SettingsControl
*/
handleClickOutside(e: Event) {
handleClickOutside(e: any) {
if (!this.props.isMobile && !!this._controlSettingsElement && !this._controlSettingsElement.contains(event.target) && this.state.smartContainerOpen) {
e.stopPropagation();
if (e.target.classList.contains('overlay-play')) {
e.stopPropagation();
}
this.setState({smartContainerOpen: false});
}
}
Expand Down

0 comments on commit 56e9d86

Please sign in to comment.