Skip to content

fix(sidebar): make tab dragging smooth and reliable - #257

Open
barto95100 wants to merge 2 commits into
the-ora:mainfrom
barto95100:contrib/174-tab-drag
Open

barto95100 wants to merge 2 commits into
the-ora:mainfrom
barto95100:contrib/174-tab-drag

Conversation

@barto95100

Copy link
Copy Markdown

Summary

Closes #174.

  • Drop delegates use the dragged tab id right away instead of reading it back asynchronously from the drag item on every hover, which made the list lag and could apply moves out of order.
  • Moving a tab renumbers only its section (favorites, pinned or normal), like a list: dragged down it lands after the target, up before it, from another section in its place. The old reorder swapped orders across all sections, could index out of bounds and leave duplicate orders (empty-looking tabs, odd spacing).
  • The window drag gesture now sits behind the tabs: on top of them it competed with tab drags, which got cancelled or stuck to the mouse, and it was never re-enabled after a first tab drag.
  • Each drag has its own session: the drag item of a previous drag, released late, no longer ends the current one.
  • Duplicated tabs land right after the original.

Type of Change

  • Bug fix

Testing

  • Unit tests: TabReorderingTests (pure reordering rules).
  • Manual: reordering within normal, pinned and favorite tabs, and across sections; fast repeated drags of the same tab; dropping outside the sidebar; clicking a tab right after a drag; moving the window from the sidebar's empty space; duplicating a tab.

AI Assistance Disclosure

Code written with Claude (AI) under my direction; I reviewed and tested every change on macOS.

Checklist

  • Code builds successfully
  • No new warnings or errors

Fixes the-ora#174.

- Drop delegates use the dragged tab id right away instead of reading it
  back asynchronously from the drag item on every hover (lag, moves applied
  out of order).
- Moving a tab renumbers only its section (favorites, pinned or normal), like
  a list: dragged down it lands after the target, up before it, from another
  section in its place. The old reorder swapped orders across all sections and
  could index out of bounds or leave duplicate orders.
- The window drag gesture now sits behind the tabs: on top of them it competed
  with tab drags, which got cancelled or stuck to the mouse, and it was never
  re-enabled after a first tab drag.
- Each drag has its own session: the drag item of a previous drag, released
  late, no longer ends the current one.
- Duplicated tabs land right after the original.
- Tests: TabReorderingTests.
@greptile-apps

greptile-apps Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The changes stay within sidebar tab organization and window-drag interactions.

The PR appears safe to merge with two non-blocking tab-placement issues.

Findings

  1. P2 Duplicates land in the wrong place ▶
  2. P2 A downward drag does nothing ▶

Summary

This PR makes tab moves synchronous and limits renumbering to the destination section.

  • Tab drops reorder only the destination section and place duplicates beside their source.
  • Sidebar tab drags keep their own state while window movement stays behind the content.
  • Opening a tab keeps the same behavior with flatter setup code.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Start tab drag] --> B[Store tab ID and drag session]
  B --> C{Hover target}
  C -->|Existing tab| D[Move tab and renumber destination section]
  C -->|Empty section| E[Change section and set order to 1]
  D --> F[Drop saves changes]
  E --> F
  B --> G[Provider released]
  G --> H{Session still current?}
  H -->|Yes| I[Clear drag state]
  H -->|No| J[Leave current drag alone]
Loading

Reviews (1) · Last reviewed commit: "fix(sidebar): make tab dragging smooth a..." · Reviewed by Greptile

…ayed order when moving

- A duplicated tab is placed right after its original, in its section
  (pinned and favorite ones included): its order, count + 1, could be below
  the original's, so moving it onto the original put it before.
- Moves start from the section in the order the sidebar shows it, the
  moved tab included: with tabs sharing an order, a move down by one place
  could leave the list unchanged. Each move renumbers the section.
- Tests for inserting after the original.

This branch has not been deployed

No deployments
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.

Tab Dragging Feels Laggy and Causes Empty Tabs or Misaligned Spacing

1 participant