Skip to content

Fix text selection not starting over markdown tables#12841

Open
zachlloyd wants to merge 1 commit into
masterfrom
oz-agent/fix-table-selection-hit-testing
Open

Fix text selection not starting over markdown tables#12841
zachlloyd wants to merge 1 commit into
masterfrom
oz-agent/fix-table-selection-hit-testing

Conversation

@zachlloyd

@zachlloyd zachlloyd commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes being unable to start a text selection inside a rendered Markdown table in agent output (e.g. clicking and dragging within a table no longer does nothing).

Root cause: The WarpUI Table paints its row/header backgrounds and dividers with draw_rect_with_hit_recording, in a paint layer above the enclosing SelectableArea. On LeftMouseDown, SelectableArea bails when the point is "covered" (event.at_z_index(...).is_none()), so a mouse-down that originates over the table never starts a selection. Drag events aren't subject to that coverage check, which is exactly why starting a selection outside the table and dragging in worked, but starting inside the table did nothing.

Fix: Mark the Table's body paint layer click-through (set_active_layer_click_through) so its decorative chrome no longer makes the underlying SelectableArea treat the point as covered. This mirrors the notebook/editor table renderer (crates/editor/src/render/element/table.rs), which already marks its paint layer click-through.

https://www.loom.com/share/7dd109b714324afb82d08c88adb758e1

Linked Issue

#12751

  • The linked issue is labeled ready-to-spec or ready-to-implement.
  • Where appropriate, screenshots or a short video of the implementation are included below.

Testing

  • cargo fmt and cargo clippy -p warpui_core -- -D warnings pass.

  • Verified the behavior with computer use using the table-sample example's selection demo (screenshot below): a click-drag that starts inside the table now selects text.

  • Follow-up: a deterministic regression test can be added in crates/warpui_core/src/elements/table/mod_tests.rs (App::test harness) asserting that a LeftMouseDown over a Table inside a SelectableArea starts a selection.

  • I have manually tested my changes locally

Screenshots / Videos

Computer-use verification screenshot attached in the originating Oz conversation.

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent Mode

Conversation: https://staging.warp.dev/conversation/9b55249d-1f57-4c94-87d0-c696c19628bf
Run: https://oz.staging.warp.dev/runs/019ed67b-be88-7b9d-94f4-24714fca3f2e

This PR was generated with Oz.

Mark the WarpUI Table's body layer click-through so its row/header
background and divider rects (drawn with hit recording) don't make an
enclosing SelectableArea treat a mouse-down over the table as covered.

Previously, starting a selection inside a table did nothing because
SelectableArea bails on a covered LeftMouseDown; dragging in from
outside worked because drag events aren't subject to that check. This
matches the notebook/editor table, which already marks its paint layer
click-through.

Co-Authored-By: Oz <oz-agent@warp.dev>
@cla-bot cla-bot Bot added the cla-signed label Jun 19, 2026
@zachlloyd zachlloyd requested a review from zachbai June 19, 2026 20:42
@zachlloyd zachlloyd marked this pull request as ready for review June 19, 2026 20:42
@oz-for-oss

oz-for-oss Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

@zachlloyd

I'm starting a first review of this pull request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@oz-for-oss oz-for-oss Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Overview

This PR marks the WarpUI table body paint layer as click-through so table chrome no longer prevents the enclosing SelectableArea from receiving mouse-down events that start text selection inside rendered markdown tables.

Concerns

  • ⚠️ [IMPORTANT] For this user-facing behavior change, the attached review context does not include a direct screenshot or screen recording. The description only says the screenshot is attached in the originating Oz conversation, so please attach visual evidence to the PR demonstrating selection starting inside a rendered markdown table.
  • 💡 [SUGGESTION] Consider adding the deterministic SelectableArea/Table regression test described in the PR so this hit-testing path remains covered.

Verdict

Found: 0 critical, 1 important, 1 suggestion

Request changes

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@zachlloyd zachlloyd enabled auto-merge (squash) June 19, 2026 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants