fix(ui): remove phantom context menu scrollbars
Keep hidden submenus in viewport-fixed positioning from their first layout so they do not enlarge the root context menu scroll area before hover. Preserve viewport-safe submenu placement for mouse and keyboard activation.
This commit is contained in:
@@ -243,7 +243,7 @@ body,
|
||||
.menu-submenu-dropdown {
|
||||
position: absolute;
|
||||
top: -4px;
|
||||
left: 100%;
|
||||
left: 0;
|
||||
z-index: 1001;
|
||||
min-width: max-content;
|
||||
background: var(--card);
|
||||
@@ -2712,7 +2712,7 @@ td {
|
||||
|
||||
.ctx-menu-sub-items {
|
||||
display: block;
|
||||
position: absolute;
|
||||
position: fixed;
|
||||
left: 100%;
|
||||
top: 0;
|
||||
min-width: 120px;
|
||||
|
||||
@@ -112,4 +112,9 @@ describe("ContextMenu", () => {
|
||||
expect(stylesSource).toMatch(/\.ctx-menu-sub:hover\s*>\s*\.ctx-menu-sub-items\.is-positioned/s);
|
||||
expect(contextMenuSource).toContain('window.addEventListener("pointerdown", onOutside, true)');
|
||||
});
|
||||
|
||||
it("keeps hidden submenus outside the root menu scroll area before hover", () => {
|
||||
expect(stylesSource).toMatch(/\.ctx-menu-sub-items\s*{[^}]*position:\s*fixed;/s);
|
||||
expect(stylesSource).not.toMatch(/\.ctx-menu-sub-items\s*{[^}]*position:\s*absolute;/s);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user