Skip to content

Agent: give the lightbox close button one tooltip - #1235

Merged
AnthonyRonning merged 1 commit into
masterfrom
fix/lightbox-tooltip
Oct 23, 2026
Merged

AnthonyRonning merged 1 commit into
masterfrom
fix/lightbox-tooltip

Conversation

@doowta

@doowta doowta commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Why

  • Opening an attached image full size panics in debug builds. The lightbox's close button gets two tooltips, and gpui allows one per element.
  • Release builds don't crash: the second tooltip quietly replaces the first.

What this PR changes

  • The close button gets one tooltip, still "Close" with the live Escape shortcut, so release builds look the same as before.
  • A new widgets::icon_button_for_action is an icon_button whose tooltip also shows the action's shortcut, so a caller no longer adds a second .tooltip to get the hint.
Details for reviewers (cause, scope, tests)

Base and scope

  • Rebased locally onto freshly fetched origin/master at cc67565bca98a669b02ce4a39e7ec710d978c358.
  • 3 files, 44 insertions, 4 deletions.

Files

  • apps/maple-agent/app/src/ui/widgets.rs
  • apps/maple-agent/app/src/ui/chat/mod.rs
  • apps/maple-agent/app/src/ui/chat/tests.rs

Commits

  1. Give the lightbox close button one tooltip.

Cause

  • icon_button has attached a tooltip from its label since the widgets accessibility pass (6991072). The lightbox close button kept the explicit .tooltip(tooltip_for_action("Close", &ChatEscape)) it had from before that, so the element got two. gpui's Interactivity::tooltip has a debug_assert! that fires on the second call.
  • This was the only icon_button call site that added its own tooltip.

Design

  • icon_button and icon_button_for_action share a private icon_button_base (role, label, focus ring, hover, delay, icon). Each one attaches exactly one tooltip: tooltip(label, None) or tooltip_for_action(label, action).
  • Scope: the lightbox close button only. Other icon buttons are unchanged.

Tests

  • Manual check in a local debug build (macOS): on master (cc67565b), opening an attached image full size crashed with "calling tooltip more than once on the same element is not supported". With this branch, the same image opens full size with no crash.
  • test_lightbox_draws_and_escape_closes_it: opens the lightbox in a test window, draws a frame, and checks that the Escape handler closes it. Without the fix it panics with "calling tooltip more than once on the same element is not supported"; with it, it passes.
  • Local validation after rebasing onto cc67565b: cargo fmt --all -- --check passed; cargo test -p maple-agent-app --locked -- test_lightbox_draws_and_escape_closes_it passed (1 test); cargo clippy -p maple-agent-app --all-targets --locked -- -D warnings passed.
  • Full CI runs on GitHub after push. The local just ci run was stopped at Michael's request after formatting, all nine Git metadata tests, and all four Clippy feature sets passed; its workspace build and full test suites were not completed.

🤖 Generated with Claude Code

icon_button already attaches a tooltip from its label, and the lightbox
added a second one for the Escape hint. gpui allows one tooltip per
element and asserts it in debug builds, so opening an image panicked
there; release builds kept the second one. widgets gains
icon_button_for_action, an icon_button whose tooltip names the
action's shortcut, and the close button uses it, so it still reads
"Close" with the live Escape binding.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@AnthonyRonning
AnthonyRonning merged commit 692b33f into master Oct 23, 2026
35 of 36 checks passed
@AnthonyRonning
AnthonyRonning deleted the fix/lightbox-tooltip branch October 23, 2026 21:05
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.

2 participants