Skip to content

Add the dock's context menu and panel commands - #60

Merged
Pante merged 12 commits into
mainfrom
feature/dock-context-menu
Nov 27, 2026
Merged

Pante merged 12 commits into
mainfrom
feature/dock-context-menu

Conversation

@Pante

@Pante Pante commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Panel commands. A command can run on a panel, or without a target on the active panel of the dock shown. The built-in ones close a panel, the others in its group, all, or those to its left or right, split its group by moving it right or down, and hide a tabless panel that cannot be closed. Ctrl+F4, or Cmd+W on macOS, closes the active tab; Shift+Escape hides.
  • Context menu. A right-click on a panel's header opens a menu of the panel commands, run on that panel. Plugins add groups with docks.addContextMenu; the built-in groups are DEFAULT_DOCK_CONTEXT_MENU. A file's tab copies its paths and opens the file in the file manager, and a terminal's renames its session in a popover below the tab.
  • Keys in the dock. A key pressed in the dock runs the panel commands bound to it on the active panel. A terminal leaves the close key to the dock, and Cmd+Shift+W closes the window on macOS.
  • Focus. A panel takes the focus when it becomes active, when a dock attaches and when its tab is clicked. Content picks what it focuses with usePanelFocus; a custom panel sets a CustomPanelHandle on its ref. A tab's context menu gives the focus back when it closes.
  • Tooltips. A tab shows a tooltip after 600ms: a file's absolute path, a terminal's session name. A CustomPanelSource has an optional tooltip.
  • Settings. A Workspace page has workspace.closeActivation (the tab on the left, on the right, or the most recent after a close) and workspace.tabTooltips.
  • Overflowing tabs menu. A row renders the panel's header, so a custom panel is listed like any other.

Testing

  • Biome and typecheck pass for web, components and frontend-plugin.
  • Unit tests pass (web 423, components 93, frontend-plugin 37).
  • Browser tests pass: web 1527 (1 skipped), components 55, ten runs in a row.

🤖 Generated with Claude Code

Pante and others added 10 commits November 27, 2026 10:33
A row of the menu renders the panel's header, the component its tab shows, so a custom panel is listed like any other
and a file's row has its unsaved changes dot. The menu no longer draws an icon per type or its own close button. A
custom panel without a source has no row.

DockTabHeader shows its close button in a highlighted menu item as in a hovered tab, and its title grows and truncates.
DropdownMenuItem takes recolor, which is off for a row whose content keeps its own colors while highlighted.

A panel component has a header in place of a tab, and every panel's tab is one Tab that adds dragging and the tabless
marker around it. The tabs per type are gone, and the files of the file's and terminal's are named for their headers.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A panel command runs on a panel, e.g. to close or move it, and without a target on the active panel of the dock shown.
The command manager tells a panel from the other targets, which a terminal's and a file's panel used to pass for.

The built-in ones close a panel, the other tabs of its group, all of them, or those to its left or right, and split
its group by moving it right or down. Several panels close one after another, so that only one asks at a time. Close
has the default key Ctrl+F4, or Cmd+W on macOS, which nothing dispatches yet.

A command is hidden for a panel it can never apply to, or when it would shift nothing above it in a menu, and is then
disabled too.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A right-click on a panel's header opens a menu of the panel commands, run on that panel: closing it, the others, all,
or those to its left or right, and splitting its group by moving it. The click does not activate the tab. Plugins add
groups with Docks.addContextMenu, and an item for one kind of panel hides for the others through its command.

The menu's trigger is stretched over the padding of dockview's tab, so that it opens anywhere on the tab. A tab reads
its panel from the dock, and so renders again when the dock changes.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A file's tab can copy its absolute path or its path from the workspace, and open the file in the file manager. A
terminal's tab can rename its session. They are panel commands that hide for other kinds of panel, and share their
logic with the file tree's commands. The menu groups the paths under "Copy path" and the moves under "Split and move",
as the file tree's menu does.

Renaming a session opens a popover below the tab, flush with its left edge, since a field in a tab would resize it and
shift the tabs after it. The popover keeps a right-click in its field from the tab's menu, and leaves the focus alone
when it closes, which would otherwise land on the tab's close button. The tab's menu leaves the focus to what its item
focuses. The field is the sidebar's, now shared.

A terminal's header shows the session's name once it is renamed, where it kept dockview's stale title.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A key pressed in the dock runs the panel commands bound to it on the active panel, so Ctrl+F4, or Cmd+W on macOS,
closes the active tab. A key pressed in a menu or popover of the dock is left alone, as is one pressed outside it.

A terminal sends its keys to the shell, so it leaves the key of an allowed command to the dock. Close is the only one
allowed for now. On macOS the window closes on Cmd+Shift+W, which leaves Cmd+W to the panel.

Hide is a new panel command for a tabless panel that cannot be closed, such as the file tree. It hides the panel's
group and shares the close key, with Shift+Escape as another.

The close commands move from panel.close to panel.view, beside hide.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Dockview tracks whether a panel has the focus but never moves it: a click on a tab left the focus on the tab, and a
closed panel left it on nothing, so that the next key did nothing. A panel is now asked to take the focus when it
becomes the active panel, when a dock attaches, and when its tab is clicked.

The dock only records the request. Every panel's content is rendered in one Panel, as every header is in one Tab,
which moves the focus when the request is for its panel: to what the content picks with usePanelFocus, else to its
first focusable element. Content that has nothing to focus yet, e.g. an editor whose file loads, takes the focus once
it has, unless the focus has gone outside the dock meanwhile.

The editor that edits the file, the terminal and the file tree pick what they focus. A custom panel sets a handle with
a focus function on the ref its component is given.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Closing the tab shown in a group left it to dockview to show the one that was shown before it. The frontend settings
now have workspace.closeActivation: the tab on the left, which is the default, the tab on the right, or the most
recent one. The left and right fall back to the other side at either end. A Workspace page in the settings, after the
keymap's, has it as "Tab after close".

The dock shows the successor before it closes the tab, and activates it if the tab was the active panel, so that it
takes the focus. A panel is closed in one place, DockManager.close, which takes a force flag that the contract does
not have: whether the panel can be closed and what it shows are then not asked. A terminal whose shell exited and
custom panels whose source is gone close that way.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A tab shows a tooltip below it, flush with its left edge as the rename popover is, once the pointer rests on it for
600ms. A file's shows its absolute path and a terminal's the name of its session, each on one line. The file tree and
the placeholder have none. Every tab waits out the delay, since the pointer crosses tabs on its way to one.

A panel source has a tooltip function, called each time the tooltip is about to open, which returns what to show or
null for none. A source that throws shows none. A terminal returns null while its session is renamed, since the rename
popover opens where the tooltip does.

The tooltip opens on hover only: the focus of a popover in the header reaches the tab, which would otherwise open the
tooltip over it. Anything in the header that takes the focus closes it.

TooltipContent takes an anchor, as PopoverContent does. sameSession compares two terminal sessions, beside
sameWorkspace.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A press on a tab moves the focus to the tab before its context menu opens, so the menu left the focus on nothing once
it closed. The tab now remembers what had the focus at the press, and focuses it again when the menu closes, whether
that was a panel or something outside the dock.

An item still has the last word: one that shows a field, e.g. to rename a session, keeps the focus there, and one that
closes the panel that had the focus leaves it to the panel that becomes active.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The frontend settings have workspace.tabTooltips, on by default. The Workspace page has it as "Tab tooltips", a switch
after "Tab after close", with an illustration of a tab bar that shows the tooltip while it is on. While it is off, a
tab asks no panel for a tooltip, so it covers files, terminals and custom panels alike.

Two tests that expect no tooltip waited less than the tooltip's delay, and now wait past it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Comment thread apps/web/test/dock-stubs.tsx Resolved
Pante and others added 2 commits November 27, 2026 16:57
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The test before it clicks the close button, which leaves the pointer where the next tab's close button renders. The
tab then counted as hovered once Chromium updated the hover, and hid the status the test expects.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@claude

claude Bot commented Nov 27, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@Pante
Pante enabled auto-merge November 27, 2026 11:10
@Pante
Pante added this pull request to the merge queue Nov 27, 2026
Merged via the queue into main with commit 6672fbc Nov 27, 2026
14 checks passed
@Pante
Pante deleted the feature/dock-context-menu branch November 27, 2026 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant