Skip to content

Conversation

@MyPrototypeWhat
Copy link
Collaborator

@MyPrototypeWhat MyPrototypeWhat commented Jan 15, 2026

What this PR does

Before this PR:

  • No browser-like tab system in v2 branch
  • Cannot detach tabs to separate windows
  • Cannot attach detached windows back to main window

After this PR:

  • Implements browser-like tab bar UI with pinned/normal tabs
  • Supports tab detach (drag out to create new window)
  • Supports tab attach (drag back to main window)

Related to: #11460 (Feature 4 & 5)

Why we need it and why it was done in this way

This PR implements Feature 4 (Tab Detach) and Feature 5 (Tab Attach) from the v2 tab system design.

The following tradeoffs were made:

  • Pinned tabs are persisted to localStorage, normal tabs are memory-only (cleared on restart)
  • Tab bar uses dnd-kit with DragOverlay for smooth drag animations without flickering

The following alternatives were considered:

  • Persisting all tabs vs only pinned tabs - chose pinned-only for cleaner UX on restart
  • Using Sortable component vs manual dnd-kit - chose manual implementation for better flex layout control

TODO List

Completed

  • Basic tab bar UI component (AppShellTabBar)
  • Tab state management (useTabs hook)
  • Pinned tabs persistence (localStorage)
  • Normal tabs memory storage
  • Tab drag-and-drop sorting with DragOverlay (no flickering)
  • Pinned tabs drag-and-drop sorting
  • Tab drag-out boundary detection (detachTab callback)
  • isDetached mode (hide Home Tab, close button, + button)
  • DetachedAppShell component for detached windows
20260116-140606.mp4

Feature 1: Tab Detach (Drag Out to Window)

  • Drag event handling and boundary detection
  • isDetached mode for detached window UI
  • DetachedAppShell with URL query params initialization
20260116-173507.mp4

Feature 2: Tab Attach (Drag Back to Main)

  • Drop zone detection on main window tab bar
  • IPC state transfer protocol (tab:attach-request / tab:attach-response)
  • Window close coordination after successful attach
  • Tab insertion position handling

Breaking changes

None

Checklist

  • PR: The PR description is expressive enough and will help future contributors
  • Code: Write code that humans can understand and Keep it simple
  • Refactor: You have left the code cleaner than you found it (Boy Scout Rule)
  • Upgrade: Impact of this change on upgrade flows was considered and addressed if required
  • Documentation: A user-guide update was considered and is present (link) or not required

- Reorganized the AppShell component to utilize a new AppShellTabBar for improved tab management.
- Removed the previous tab handling logic and integrated the new tab bar for better UI consistency.
- Enhanced the layout structure to support a more flexible design with a sidebar and main content area.
- Added functionality for handling tab interactions, including adding and closing tabs.
…ionality

- Updated RendererPersistCacheSchema to support pinned tabs instead of tab state.
- Refactored AppShellTabBar to include drag-and-drop capabilities for reordering both pinned and normal tabs.
- Introduced SortableTabItem and SortablePinnedTab components for improved tab interaction.
- Enhanced state management for active tabs during drag events, ensuring a smoother user experience.
- Updated PinnedTabs and normal tab rendering to utilize new sortable components.
…handling

- Added TabsContext to manage tab state and operations globally across the application.
- Refactored App component to integrate TabsProvider for improved tab management.
- Updated Sidebar and AppShell components to utilize the new context for accessing active tab information and updating tabs.
- Enhanced tab handling logic, including the ability to reorder tabs and manage active states more effectively.
- Removed legacy tab state management from useTabs hook, streamlining tab operations through the new context.
… management

- Added DetachedWindowManager to handle the creation and management of detached windows for tabs.
- Introduced detachedWindow.html for rendering content in detached windows.
- Updated TabsContext to include detachTab functionality, allowing tabs to be moved to a new window.
- Enhanced AppShell and AppShellTabBar components to support detaching tabs via drag-and-drop.
- Refactored related components to accommodate the new detached window feature, improving user experience and tab management.
@DeJeune DeJeune added the v2 label Jan 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants