feat(ui): close tabs and panel headers with middle mouse button (#1613)

A middle click on a tool window header hides the window, as its Hide button does; presses on the header's tabs and buttons keep their own behaviour. Editor tabs already closed on a middle click, except when Settings › Editor Tabs hides the close button: that marked the tabs as not closable, so a middle click (and Delete) did nothing. A tab item now hides only its close button and still closes.

Co-authored-by: Inf1mum <[email protected]>
Цей коміт міститься в:
Vadim LazukтаInf1mum authored and GitHub committed 2026-11-06 02:55:26 +08:00
1 джерело 8689271e7c
коміт 653f2ff276
4 files changed
+112 -3

No files matched your search

+18
Переглянути файл
@@ -117,6 +117,24 @@ describe("Tabs interactions", () => {
expect(onSelect).toHaveBeenCalledWith("c");
});
it("middle click closes a tab without selecting it", () => {
const onClose = vi.fn();
const onSelect = vi.fn();
render(<Tabs items={items} activeId="a" onSelect={onSelect} onClose={onClose} />);
fireEvent.mouseDown(screen.getByRole("tab", { name: "B" }), { button: 1 });
expect(onClose).toHaveBeenCalledWith("b");
expect(onSelect).not.toHaveBeenCalled();
});
it("middle click ignores tabs that cannot close", () => {
const onClose = vi.fn();
const onSelect = vi.fn();
render(<Tabs items={items} activeId="a" onSelect={onSelect} onClose={onClose} />);
fireEvent.mouseDown(screen.getByRole("tab", { name: "C" }), { button: 1 });
expect(onClose).not.toHaveBeenCalled();
expect(onSelect).not.toHaveBeenCalled();
});
it("keeps Shift+click selection where the strip does not opt in", () => {
const onClose = vi.fn();
const onSelect = vi.fn();