Skip to content

Commit f770bda

Browse files
authored
fix(ui): align top-menu dropdowns (#176)
1 parent c7bc1ba commit f770bda

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

src/ui/components/chrome/menu.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ export const MENU_ORDER = Object.keys(MENU_LABELS) as MenuId[];
3434
export function buildMenuSpecs() {
3535
return MENU_ORDER.reduce<MenuSpec[]>((items, id) => {
3636
const previous = items.at(-1);
37-
const left = previous ? previous.left + previous.width + 1 : 1;
37+
// Each menu label already includes its own leading/trailing padding inside the fixed-width box,
38+
// so adjacent menu boxes are packed directly next to each other without an extra inter-box gap.
39+
const left = previous ? previous.left + previous.width : 1;
3840
items.push({
3941
id,
4042
left,

src/ui/lib/ui-lib.test.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,14 @@ describe("ui helpers", () => {
8383
"agent",
8484
"help",
8585
]);
86-
expect(specs[0]).toMatchObject({ id: "file", left: 1, width: 6, label: "File" });
87-
expect(specs[1]?.left).toBe(specs[0]!.left + specs[0]!.width + 1);
86+
expect(specs).toMatchObject([
87+
{ id: "file", left: 1, width: 6, label: "File" },
88+
{ id: "view", left: 7, width: 6, label: "View" },
89+
{ id: "navigate", left: 13, width: 10, label: "Navigate" },
90+
{ id: "theme", left: 23, width: 7, label: "Theme" },
91+
{ id: "agent", left: 30, width: 7, label: "Agent" },
92+
{ id: "help", left: 37, width: 6, label: "Help" },
93+
]);
8894
});
8995

9096
test("nextMenuItemIndex skips separators in both directions", () => {

0 commit comments

Comments
 (0)