Skip to content

Commit

Permalink
fix: do not close manual tooltip on target mousedown (#7746) (#7755)
Browse files Browse the repository at this point in the history
Co-authored-by: Serhii Kulykov <iamkulykov@gmail.com>
  • Loading branch information
vaadin-bot and web-padawan authored Sep 4, 2024
1 parent 101eaba commit e8e6a02
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/menu-bar/src/vaadin-menu-bar-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ export const MenuBarMixin = (superClass) =>
});
this.addController(this._overflowController);

this.addEventListener('mousedown', () => this._hideTooltip());
this.addEventListener('mousedown', () => this._hideTooltip(true));
this.addEventListener('mouseleave', () => this._hideTooltip());

this._subMenu.addEventListener('item-selected', this.__onItemSelected.bind(this));
Expand Down
4 changes: 4 additions & 0 deletions packages/tooltip/src/vaadin-tooltip-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,10 @@ export const TooltipMixin = (superClass) =>

/** @private */
__onMouseDown() {
if (this.manual) {
return;
}

this._stateController.close(true);
}

Expand Down
6 changes: 6 additions & 0 deletions packages/tooltip/test/tooltip.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,12 @@ describe('vaadin-tooltip', () => {
expect(overlay.opened).to.be.true;
});

it('should not close overlay on target mousedown', () => {
tooltip.opened = true;
mousedown(target);
expect(overlay.opened).to.be.true;
});

it('should close overlay when opened is set to false', () => {
tooltip.opened = true;

Expand Down

0 comments on commit e8e6a02

Please sign in to comment.