Skip to content

fix(bots): keep attachment previews open on hover - #516

Merged
nixuuu merged 1 commit into
devfrom
fix/bot-attachment-hover
Nov 10, 2026
Merged

nixuuu merged 1 commit into
devfrom
fix/bot-attachment-hover

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 10, 2026

Copy link
Copy Markdown
Member

Hovering an attachment in the bot composer could briefly flash a preview and close it while the pointer stayed on the chip. Keep the selected attachment and anchor stable when pointerover reaches the same chip again.

Bot and thread composers already use the same EditorAttachmentPreview and AttachmentPreview. When loaded content increases the card's height, the card can briefly cross the pointer before repositioning. Returning to the chip recreated selected, reran the anchor effect and closed the preview during cleanup. Pointer movement between the chip's icon and text had the same failure path. The shared component now updates selection only for a different chip or attachment key. Existing 300 ms open / 180 ms close delays, keyboard focus, Escape, viewers and motion tokens are preserved.

Validation:

  1. bun install --frozen-lockfile, bun run typecheck, bun run lint, bun run format, bun run format:check, and bun run --filter @canopy/web build passed. No UI tests were added or run.
  2. Real Chromium browser with an isolated gateway, database and scripted model: Markdown, PDF metadata and PNG previews in the bot composer, sent messages and actual bot-forwarded thread messages, light/dark at desktop width. Verified pointer transfer to the card, keyboard focus and Escape. Phone-width clicks open the Markdown viewer, PDF metadata actions and image lightbox in both themes. Long filenames remain within the viewport. The thread composer also retains its preview while moving repeatedly between the chip's icon and text; leaving closes it at the existing delay.
  3. Hover evidence includes eight sampled screenshot frames per theme and 100 ms visibility samples showing the card remaining open for at least two seconds. Evidence is outside the repository under /var/tmp/canopy-bot-attachment-hover/.
  4. Requested EAS CLI 27.4.1 production fingerprints are byte-identical before/after: iOS 6ddec9ef559ee0095ac33e94ff9418a942053b17; Android 5f6eae3ab278f1cd543e9ed763f923a319b65ec9. Native mobile already shares AttachmentChips between bots and threads. No native or mobile source changes.

Native device interaction remains unverified: device support twice returned “Could not communicate with device support. Try refreshing devices.” Phone-width browser interaction was checked. Full integration/temporary-directory checks and generated-contract checks were left to CI; this change only touches the shared web editor preview. Copy audit: no UI copy changed.

The faulty selection assignment was introduced by the attachment-preview implementation in #398; verified in its original diff. Bot attachment PRs reused that component.

Fixes: #398
Related: #449, #469

Keep the selected editor attachment stable across pointerover events on
the same chip. A preview that grows after loading can cross the pointer;
selecting its anchor again tore down the hover listeners and closed it.

Both bot and thread composers already share this preview component.

Fixes: #398
@nixuuu
nixuuu merged commit 7317c3b into dev Nov 10, 2026
15 of 17 checks passed
@nixuuu
nixuuu deleted the fix/bot-attachment-hover branch November 10, 2026 16:44
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.

1 participant