Skip to content

Commit 183b857

Browse files
authored
fix: hide tooltip on disabled button mouseover (#4600)
1 parent 25819af commit 183b857

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

‎integration/tests/menu-bar-tooltip.test.js‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,19 @@ describe('menu-bar with tooltip', () => {
7272
expect(tooltip.opened).to.be.false;
7373
});
7474

75+
it('should hide tooltip on menu bar container mouseover', () => {
76+
mouseover(buttons[0]);
77+
mouseover(menuBar._container);
78+
expect(tooltip.opened).to.be.false;
79+
});
80+
81+
it('should show tooltip again on menu bar button mouseover', () => {
82+
mouseover(buttons[0]);
83+
mouseover(menuBar._container);
84+
mouseover(buttons[1]);
85+
expect(tooltip.opened).to.be.true;
86+
});
87+
7588
it('should set tooltip target on menu button mouseover', () => {
7689
mouseover(buttons[0]);
7790
expect(tooltip.target).to.be.equal(buttons[0]);

‎packages/menu-bar/src/vaadin-menu-bar-interactions-mixin.js‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,10 @@ export const InteractionsMixin = (superClass) =>
305305
*/
306306
_onMouseOver(e) {
307307
const button = this._getButtonFromEvent(e);
308-
if (button && button !== this._expandedButton) {
308+
if (!button) {
309+
// Hide tooltip on mouseover to disabled button
310+
this._hideTooltip();
311+
} else if (button !== this._expandedButton) {
309312
const isOpened = this._subMenu.opened;
310313
if (button.item.children && (this.openOnHover || isOpened)) {
311314
this.__openSubMenu(button, false);

0 commit comments

Comments
 (0)