Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/menu-bar/src/vaadin-menu-bar-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -878,11 +878,11 @@ export const MenuBarMixin = (superClass) =>
// Hide tooltip on mouseover to disabled button
this._hideTooltip();
} else if (button !== this._expandedButton) {
const isOpened = this._subMenu.opened;
if (button.item.children && (this.openOnHover || isOpened)) {
// Switch sub-menu when moving cursor over another button
// with children, regardless of whether openOnHover is set.
// If the button has no children, keep the sub-menu opened.
if (button.item.children && (this.openOnHover || this._subMenu.opened)) {
this.__openSubMenu(button, false);
} else if (isOpened) {
this._close();
}

if (button === this._overflow || (this.openOnHover && button.item.children)) {
Expand Down
4 changes: 2 additions & 2 deletions packages/menu-bar/test/sub-menu.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -525,12 +525,12 @@ describe('open on hover', () => {
expect(subMenu.listenOn).to.equal(buttons[0]);
});

it('should close open sub-menu on mouseover on button without nested items', async () => {
it('should not close open sub-menu on mouseover on button without nested items', async () => {
fire(buttons[0], openOnHoverEvent);
await nextRender(subMenu);
fire(buttons[1], openOnHoverEvent);
await nextRender(subMenu);
expect(subMenu.opened).to.be.false;
expect(subMenu.opened).to.be.true;
});

it('should switch opened sub-menu on hover also when open-on-hover is false', async () => {
Expand Down