fix(web): refine image preview interactions#723
Merged
tiann merged 2 commits intoMay 29, 2026
Conversation
4bd9ae6 to
9ae4903
Compare
There was a problem hiding this comment.
Findings
- [Major] Touch-end opens the image viewer after scroll gestures —
onTouchEndfires for touch sequences that are used to scroll the chat, so starting a vertical scroll on an image preview can still open the full-screen viewer. The chat viewport is scrollable (web/src/components/AssistantChat/HappyThread.tsx:697), and this new handler bypasses the browser's click-cancellation behavior for moved touches. Evidence:web/src/components/ImagePreview.tsx:223.
Summary
- Review mode: initial
- One mobile interaction regression found in the added preview open handler.
Testing
- Not run (automation)
HAPI Bot
| onMouseDown={stopEvent} | ||
| onTouchStart={stopEvent} | ||
| onClick={openViewer} | ||
| onTouchEnd={openViewer} |
There was a problem hiding this comment.
[MAJOR] onTouchEnd opens the lightbox for every touch sequence that ends on the preview, including vertical scrolls started on an image. The chat viewport is scrollable (web/src/components/AssistantChat/HappyThread.tsx:697), so on mobile a user trying to scroll past an image can still run this handler on touchend and open the full-screen viewer. Keep opening tied to the synthesized click, which is cancelled for moved touches and already stops propagation.
Suggested fix:
<button
type="button"
onPointerDown={stopEvent}
onMouseDown={stopEvent}
onTouchStart={stopEvent}
onClick={openViewer}
className={props.buttonClassName ?? 'group flex min-h-[18rem] w-full items-center justify-center overflow-auto rounded-md border border-[var(--app-border)] bg-[var(--app-code-bg)] p-3 text-left'}
title="Click to zoom"
>There was a problem hiding this comment.
Findings
- None.
Summary
- Review mode: follow-up after new commits
- No issues found in the latest full diff. The previous bot finding around
onTouchEndwas addressed by removing that handler. - Residual risk: interaction coverage is manual only for this component; no automated ImagePreview regression test found.
Testing
- Not run (automation)
HAPI Bot
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reason
Follow-up to #715.
After testing the merged lightbox on desktop and mobile, the preview interaction needed a few refinements:
This keeps the new backdrop-close behavior, but only treats it as a close action when the press starts and ends on the backdrop with minimal movement.
Test
npm exec -- bun run typecheck:web