From f30da3d13b299b88571eb97c0329ef5c931901a0 Mon Sep 17 00:00:00 2001 From: Adorian Doran Date: Sat, 20 Sep 2025 04:02:46 +0300 Subject: [PATCH] client/menus: improve the multicolumn breaking strategy --- apps/client/src/menus/context_menu.ts | 42 ++++++++++++++++++--------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/apps/client/src/menus/context_menu.ts b/apps/client/src/menus/context_menu.ts index 1c4da4c23..574d3091c 100644 --- a/apps/client/src/menus/context_menu.ts +++ b/apps/client/src/menus/context_menu.ts @@ -157,7 +157,8 @@ class ContextMenu { } addItems($parent: JQuery, items: MenuItem[], multicolumn = false) { - let $group = $parent; + let $group = $parent; // The current group or parent element to which items are being appended + let shouldStartNewGroup = false; // If true, the next item will start a new group let shouldResetGroup = false; // If true, the next item will be the last one from the group for (let index = 0; index < items.length; index++) { @@ -166,24 +167,37 @@ class ContextMenu { continue; } - // If the next item is a separator or header, create a new group to avoid column breaks - // before and after the seaparator/header. - // This is a workaround for Firefox not supporting break-after: avoid on columns. - const nextItem = (index < items.length - 1) ? items[index + 1] : null; - if (multicolumn && nextItem && "kind" in nextItem) { - if (nextItem.kind === "separator" || nextItem.kind === "header") { - if (!shouldResetGroup) { - $group = $("