[common] don't open context menu if no items

This commit is contained in:
Maxim Kadushkin 2021-04-12 18:10:03 +03:00
parent 2bd901f3a6
commit a9dda7fe6f

View file

@ -109,15 +109,17 @@ class ContextMenuController extends Component {
extraItems: this.initExtraItems() extraItems: this.initExtraItems()
}); });
this.$targetEl.css({left: `${x}px`, top: `${y}px`}); if ( this.state.items.length > 0 ) {
const popover = f7.popover.open(idContextMenuElement, idCntextMenuTargetElement); this.$targetEl.css({left: `${x}px`, top: `${y}px`});
const popover = f7.popover.open(idContextMenuElement, idCntextMenuTargetElement);
if ( Device.android ) if (Device.android)
this.offsetPopoverTop(popover); this.offsetPopoverTop(popover);
this.setState(state => { this.setState(state => {
return {opened: true} return {opened: true}
}); });
}
} }
} }