Skip to content

Commit af864a0

Browse files
web-padawanvaadin-bot
authored andcommitted
fix: do not trap focus on item Tab, extract keyboard tests (#8912)
1 parent 53fcb61 commit af864a0

File tree

4 files changed

+469
-260
lines changed

4 files changed

+469
-260
lines changed

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

+8
Original file line numberDiff line numberDiff line change
@@ -881,6 +881,14 @@ export const MenuBarMixin = (superClass) =>
881881
const increment = e.shiftKey ? -1 : 1;
882882
let idx = currentIdx + increment;
883883
idx = this._getAvailableIndex(items, idx, increment, (item) => !isElementHidden(item));
884+
885+
if ((idx > currentIdx && e.shiftKey) || (idx < currentIdx && !e.shiftKey)) {
886+
// Prevent "roving tabindex" logic and let the normal Tab behavior if
887+
// - currently in the first button submenu and Shift + Tab is pressed,
888+
// - currently in the last button submenu and Tab is pressed.
889+
return;
890+
}
891+
884892
this.__switchSubMenu(items[idx]);
885893
}
886894
}

0 commit comments

Comments
 (0)