Skip to content

fix: keep tab and sidebar clicks when the terminal reports a stray drag - #2736

Merged
ogulcancelik merged 4 commits into
herdrdev:masterfrom
HackAttack:tab-click-ghostty-workaround
Aug 13, 2026
Merged

ogulcancelik merged 4 commits into
herdrdev:masterfrom
HackAttack:tab-click-ghostty-workaround

Conversation

@HackAttack

Copy link
Copy Markdown
Contributor

This works around a Ghostty bug that causes herdr tabs to be unclickable in fullscreen mode.

Ghostty on macOS in native fullscreen emits one motion report after a fresh press in the strip where the menu bar reveals, with the row shifted to near the bottom of the grid. The cause is upstream: macOS delivers one mouse event whose y is nearly a window height away from the real pointer, and Ghostty reports it as it arrives (iTerm2 and Terminal.app report the same clicks correctly).

Herdr treated the stray report as a real drag and lost the click two ways: it opened a tab reorder with no drop target, making the release a no-op, and it handed the release to the pane under the bogus coordinates.

Now, a press on the tab bar or sidebar owns the gesture until release, and a tab drag only starts once the pointer is over a real drop target.

refs #796

@kangal-bot kangal-bot added the ai-review Trigger automated AI reviews for pull requests admitted by the PR gate label Aug 12, 2026
@coderabbitai

coderabbitai Bot commented Aug 12, 2026 •

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: dc023a81-6112-4d7a-8ce1-46ff35c5ac8e

📥 Commits

Reviewing files that changed from the base of the PR and between d36ca39 and f477c7c.

📒 Files selected for processing (4)
  • src/app/input/mouse.rs
  • src/app/input/sidebar.rs
  • src/app/mod.rs
  • src/app/state.rs
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/app/input/sidebar.rs
  • src/app/input/mouse.rs

📝 Walkthrough

Walkthrough

Mouse handling now tracks Chrome gestures by input source. Matching-source checks control pane forwarding, reordering, and release cleanup. Tests cover stray reports and concurrent gestures. The changelog records the native fullscreen tab-bar fix.

Changes

Chrome Mouse Input

Layer / File(s) Summary
Track input-source ownership
src/app/input/mod.rs, src/app/input/mouse.rs, src/app/state.rs, src/app/mod.rs
Mouse handling receives source_id. Press and drag state stores source ownership in maps and reorder targets.
Filter chrome and pane events
src/app/input/mouse.rs
Matching-source checks control pane forwarding, Chrome cleanup, reorder targets, and gesture completion. Reordering requires source ownership and a valid drop target.
Clear and validate source state
src/app/input/terminal.rs, src/app/input/mouse.rs, src/app/input/sidebar.rs, src/ui/sidebar.rs, docs/next/CHANGELOG.md
Input-source release paths clear Chrome state. Regression tests and fixtures cover source-aware drag targets, stray reports, concurrent gestures, and mouse-reporting panes. The changelog records the fullscreen tab-bar fix.

Estimated code review effort: 4 (Complex) | ~45 minutes

Mergeability Score: 🟡 Moderate · up to f477c

The change preserves tab and sidebar clicks and delays tab drags until a valid drop target exists, but unrelated input can still alter or complete an active reorder, creating incorrect tab or workspace movement; merge should wait for that behavior to be fixed or explicitly accepted.

Sequence Diagram(s)

sequenceDiagram
  participant InputSource
  participant InputRouter
  participant AppState
  participant MouseHandler
  participant Pane
  InputSource->>InputRouter: mouse event with source_id
  InputRouter->>AppState: handle_mouse(source_id, mouse)
  AppState->>MouseHandler: process source-aware gesture
  MouseHandler->>Pane: forward only when no matching Chrome gesture is pending
  InputSource->>AppState: release input source
  AppState->>MouseHandler: clear source-owned Chrome state
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 53.13% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the primary fix for tab and sidebar clicks lost after a stray terminal drag report.
Description check ✅ Passed The description accurately explains the Ghostty fullscreen issue and the gesture-handling changes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f1975b41-f746-4149-ba8e-501db4e6a126

📥 Commits

Reviewing files that changed from the base of the PR and between 49e333a and df2890d.

📒 Files selected for processing (2)
  • docs/next/CHANGELOG.md
  • src/app/input/mouse.rs

Comment thread docs/next/CHANGELOG.md Resolved
@HackAttack
HackAttack force-pushed the tab-click-ghostty-workaround branch from df2890d to b7fdfbd Compare August 13, 2026 00:30
@greptile-apps

greptile-apps Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR preserves tab and sidebar clicks when Ghostty emits a stray motion report and completes the prior multi-client gesture-isolation fixes.

  • Tracks pending tab and workspace presses independently per input source.
  • Assigns source ownership to tab and workspace reorder drags.
  • Prevents foreign input sources from mutating or completing an owned reorder.
  • Clears only the disconnecting source’s chrome gesture state.
  • Adds regression coverage for stray motion reports and concurrent clients.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
src/app/input/mouse.rs Implements per-source chrome presses, source-owned reorders, foreign-source isolation, and regression tests for the previously reported concurrency failures.
src/app/input/terminal.rs Clears only the released input source’s pending chrome gesture during focus loss or teardown.
src/app/state.rs Extends reorder state with source ownership and replaces singleton chrome presses with per-source maps.
src/app/input/mod.rs Propagates the originating input source ID into mouse-state handling.
src/app/mod.rs Initializes the new per-source chrome press collections.
docs/next/CHANGELOG.md Documents restored tab-click behavior under Ghostty native fullscreen.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Mouse down from source] --> B{Chrome target?}
  B -->|Tab or workspace| C[Store press by source ID]
  B -->|Pane| D[Forward pane mouse report]
  C --> E[Motion report]
  E --> F{Valid drop target and threshold met?}
  F -->|No| G[Retain pending click]
  F -->|Yes| H[Create source-owned reorder]
  G --> I[Mouse up from same source]
  H --> I
  I --> J{Owned reorder active?}
  J -->|Yes| K[Commit reorder]
  J -->|No| L[Complete tab or workspace click]
  M[Event from another source] --> N[Preserve owner gesture]
  N --> D
Loading

Reviews (4): Last reviewed commit: "fix: preserve concurrent chrome presses" | Re-trigger Greptile

Comment thread src/app/input/mouse.rs Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/app/input/mouse.rs (1)

686-746: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Preserve input-source ownership for the full chrome reorder gesture.

A tab or workspace reorder loses its source_id after drag creation. Another source can then update or release that reorder.

  • src/app/input/mouse.rs#L686-L746: store the initiating source_id in active tab and workspace reorder state. Ignore nonmatching drag and release events.
  • src/app/input/terminal.rs#L361-L372: clear an active chrome reorder when its owning source releases.

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c011c1fe-692d-4981-8f2c-2722ce40526d

📥 Commits

Reviewing files that changed from the base of the PR and between b7fdfbd and 83a6250.

📒 Files selected for processing (4)
  • src/app/input/mod.rs
  • src/app/input/mouse.rs
  • src/app/input/terminal.rs
  • src/app/state.rs

HackAttack and others added 3 commits August 13, 2026 04:17
This works around a Ghostty bug that causes herdr tabs to be unclickable
in fullscreen mode.

Ghostty on macOS in native fullscreen emits one motion report after a
fresh press in the strip where the menu bar reveals, with the row
shifted to near the bottom of the grid. The cause is upstream: macOS
delivers one mouse event whose y is nearly a window height away from the
real pointer, and Ghostty reports it as it arrives (iTerm2 and
Terminal.app report the same clicks correctly).

Herdr treated the stray report as a real drag and lost the click two
ways: it opened a tab reorder with no drop target, making the release a
no-op, and it handed the release to the pane under the bogus
coordinates.

Now, a press on the tab bar or sidebar owns the gesture until release,
and a tab drag only starts once the pointer is over a real drop target.

refs herdrdev#796
@ogulcancelik
ogulcancelik force-pushed the tab-click-ghostty-workaround branch from 83a6250 to d36ca39 Compare August 13, 2026 01:19
@ogulcancelik
ogulcancelik merged commit f76d7df into herdrdev:master Aug 13, 2026
6 checks passed
@kangal-bot kangal-bot removed the ai-review Trigger automated AI reviews for pull requests admitted by the PR gate label Aug 13, 2026
@HackAttack

Copy link
Copy Markdown
Contributor Author

Thanks for the assist! I had not considered multiple concurrent clients.

bdhrs added a commit to bdhrs/herdr that referenced this pull request Aug 14, 2026