Skip to content

fix(warpui/mac) + feat(terminal): subview click cycles & circular jump-to-bottom button#80

Merged
BunsDev merged 2 commits into
mainfrom
castcodes/fix-browser-hittest
May 21, 2026
Merged

fix(warpui/mac) + feat(terminal): subview click cycles & circular jump-to-bottom button#80
BunsDev merged 2 commits into
mainfrom
castcodes/fix-browser-hittest

Conversation

@BunsDev
Copy link
Copy Markdown
Member

@BunsDev BunsDev commented May 20, 2026

Description

This PR bundles two independent changes on the same branch:

  1. fix(warpui/mac) — restore subview click cycles in WarpWindow sendEvent (the original scope of this branch — fixes browser: in-page clicks unresponsive — HTML <select>, buttons, links all dead inside webview #76).
  2. feat(terminal) — replace the rounded-square jump-to-bottom-of-block button with a full-circle, chevron-down button with a subtle outline border.

1. fix(warpui/mac) — preserve subview click cycles in WarpWindow sendEvent

Fixes #76 — embedded browser pane HTML clicks (buttons, <a>, <select> dropdowns, in-page form fields) are completely dead. Original hypothesis in #76 was wrong; the real root cause is in WarpWindow's sendEvent: override, not hitTest:.

Root cause

crates/warpui/src/platform/mac/objc/window.m:388-416 force-dispatches LeftMouseUp and LeftMouseDragged directly to self.contentView (WarpHostView) as a workaround for CLD-2581 — AppKit was mid-drag redirecting these events away from the contentView and breaking tab/pane drag-and-drop.

LeftMouseDown falls through to default: [super sendEvent:], so it reaches the embedded WKWebView normally via AppKit's hit-test. But the following LeftMouseUp is hijacked back to WarpHostView, so the WKWebView never sees mouseUp — its click cycle never completes. HTML buttons, <select>, and links all appear inert. Scrolling still works because NSEventTypeScrollWheel is already in the default: arm.

Fix (1 file, +38/-5)

In sendEvent::

  • On NSEventTypeLeftMouseDown: hit-test contentView and store the actual target view in a new _mouseDownTarget ivar before calling [super sendEvent:event].
  • On NSEventTypeLeftMouseUp / LeftMouseDragged:
    • If _mouseDownTarget == contentView (the CLD-2581 case — GPUI's tab/pane drag origin), keep the force-dispatch path.
    • Otherwise the click cycle belongs to a subview; fall back to [super sendEvent:event] so AppKit delivers to the tracking view per the documented Cocoa contract.
  • Reset _mouseDownTarget to nil on each LeftMouseUp.

RightMouseDown, key handling, and all other event paths in window.m are untouched.

Linked Issue

Closes #76.


2. feat(terminal) — circular chevron-down jump-to-bottom button

Restyles the in-block jump-to-bottom button to better match the new visual language (small, distinct circular control with a clear chevron glyph rather than a rounded-square with the vertical_align_bottom icon).

Changes (app/src/terminal/view.rs, +6/-5)

  • Icon swapped from bundled/svg/vertical_align_bottom.svgbundled/svg/chevron-down.svg.
  • Constants updated: icon 20px → 16px, padding 4px → 7px, corner radius 4px → 15px (full circle on a 30px button).
  • Background now always rendered — theme.surface_1() at rest, theme.surface_2() on hover/click.
  • Added a 1px theme.outline() border ring.
  • Tooltip / click / hover dispatch behavior unchanged.

Also: .gitignore adds .codex/ for local Codex state.


Testing

  • cargo check -p warp-app → clean, 8 pre-existing dead-code warnings (none from terminal/view.rs or window.m).
  • Built and ran via ./script/run:
    • Browser fix: reporter confirmed "clicks work" — HTML buttons, links, and <select> dropdowns are now interactive in the embedded browser pane.
    • Jump-to-bottom: dev build (target/debug/bundle/osx/CastCodes.app) launched; visual check of the new circular chevron-down button pending.

Drag-and-drop regression check (CLD-2581) — pending manual verification before mark-ready:

  • Dragging a tab within the tab bar still completes the drop.
  • Dragging a tab into a pane split (left/right edge) still completes.
  • Dragging a pane via its header / title bar to rearrange still tracks correctly.

The browser fix is designed so drags started on the GPUI canvas itself still use the force-dispatch path (because hit-test resolves to WarpHostView). But this is framework-level surgery to a known-fragile workaround, so visual verification is required.

  • I have manually tested my changes locally with ./script/run

Screenshots / Videos

To add — before/after of an in-page button click in the embedded browser pane, a tab-drag recording showing CLD-2581 still works, and a before/after of the new circular jump-to-bottom button.

Agent Mode

  • CastCodes Agent Mode - This PR was created via CastCodes Agent Mode

Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com

WarpWindow's sendEvent: override force-dispatched LeftMouseUp and
LeftMouseDragged events directly to self.contentView (WarpHostView) to
work around CLD-2581, where AppKit would mid-drag redirect events away
from the contentView and break tab/pane drag-and-drop.

That workaround also hijacked click cycles owned by native subviews.
The embedded browser pane attaches a WKWebView as a subview of
WarpHostView (via wry::WebViewBuilder::new_as_child). LeftMouseDown
went through `default: [super sendEvent:]` and reached the WKWebView,
but the subsequent LeftMouseUp was force-routed to WarpHostView, so the
WKWebView never saw mouseUp. HTML buttons, anchor links, and <select>
dropdowns all appeared dead -- only scrolling worked, because
NSEventTypeScrollWheel was already covered by the default case.

Fix: on LeftMouseDown, hit-test contentView and remember the actual
target view in a new `_mouseDownTarget` ivar. On LeftMouseUp /
LeftMouseDragged:

- if the captured target IS the contentView (the CLD-2581 case --
  GPUI's tab/pane drag origin), keep the force-dispatch path.
- otherwise the click cycle belongs to a subview, so fall back to
  [super sendEvent:event] and let AppKit deliver to the tracking view
  per the documented Cocoa contract.

Reset `_mouseDownTarget` on each LeftMouseUp.

This restores in-page interaction in the embedded browser pane (HTML
buttons, links, <select>) without regressing tab/pane drag-and-drop --
the latter still routes through the force-dispatch path because the
GPUI-rendered tab/pane interactives are part of WarpHostView's own
draw, so the hit-test resolves to WarpHostView itself.

Refs #76.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@BunsDev BunsDev marked this pull request as ready for review May 20, 2026 23:42
Copilot AI review requested due to automatic review settings May 20, 2026 23:42
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes macOS event routing in WarpWindow so embedded native subviews (notably the WKWebView used by the browser pane) receive a complete left-click cycle (MouseDown + MouseUp) instead of having MouseUp/MouseDragged forcibly rerouted to the GPUI contentView workaround path (CLD-2581).

Changes:

  • Track the view hit by NSEventTypeLeftMouseDown in a new _mouseDownTarget ivar.
  • For LeftMouseDragged / LeftMouseUp, only use the CLD-2581 force-dispatch path when the original target was the contentView; otherwise fall back to [super sendEvent:].
  • Clear _mouseDownTarget on LeftMouseUp.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Swap the rounded-square vertical-align icon for a full-circle button with a
chevron-down glyph, subtle outline border, and a default surface_1 fill that
brightens to surface_2 on hover. Also ignore local .codex/ state.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@BunsDev BunsDev changed the title fix(warpui/mac): preserve subview click cycles in WarpWindow sendEvent fix(warpui/mac) + feat(terminal): subview click cycles & circular jump-to-bottom button May 21, 2026
@BunsDev BunsDev requested a review from apple-techie May 21, 2026 01:12
@BunsDev BunsDev merged commit 68bd6b4 into main May 21, 2026
10 checks passed
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.

browser: in-page clicks unresponsive — HTML <select>, buttons, links all dead inside webview

2 participants