Skip to content

Add previous/next navigation to image Lightbox - #35507

Open
kcfancher wants to merge 36 commits into
element-hq:developfrom
kcfancher:feat/lightbox-image-navigation-update
Open

kcfancher wants to merge 36 commits into
element-hq:developfrom
kcfancher:feat/lightbox-image-navigation-update

Conversation

@kcfancher

Copy link
Copy Markdown

This PR fixes #337 by picking up where PR#31932 left off. Original work by @Snamhdaen with additional changes to add the review feedback.

User facing changes

Right now the Lightbox only shows one image which has to be closed before navigating to another. This PR adds Previous/Next buttons on either side of the image to navigate between images while in the Lightbox.

Changes since original PR (#31932) based on review feedback in that PR

  • Moved the buttons so they don't overlap the image and use Compound buttons.
  • Renamed left button label to "Previous" instead of "Back"
  • Extracted the shared helper for image as file rule
  • Add unit and Playright tests

Screenshots

Before
CleanShot 2026-10-18 at 8 15 45 AM@2x

After
CleanShot 2026-10-18 at 8 20 31 AM@2x

Testing

  1. Navigate to a room that has images in the chat (or send three images to a room)
  2. Click on an image to open the lightbox.
  3. Click "Previous"/"Next" buttons or use Left/Right arrows to navigate between images.

Checklist

  • I have read through review guidelines and CONTRIBUTING.md.
  • I have linked the PR to an issue that describes what needs changing.
  • I have written tests for new code (and old code if feasible).
  • I have ensured new or updated public/exported symbols have accurate TSDoc documentation.
  • I have confirmed linter and other CI checks pass.
  • I have have included screenshots if what the user sees will change
  • I have licensed the changes to Element by completing the Contributor License Agreement (CLA)
  • I will no longer force push to this branch

AI assistance

  • I used AI tools to help create this PR.

Snamhdaen and others added 19 commits January 31, 2026 23:20
Move navigation buttons beside the image, preserve focus at boundaries, and disable navigation during pagination. Reset zoom, rotation, and panning when the image changes.

Addresses gaelledel's design review (points 1 and 2) on element-hq#31932.
@kcfancher
kcfancher requested a review from a team as a code owner October 18, 2026 12:23
@github-actions github-actions Bot added the Z-Community-PR Issue is solved by a community member's PR label Oct 18, 2026
@kcfancher

Copy link
Copy Markdown
Author

I can't add the T-Enhancement label, but I believe that will need to be added.

A reply inside a thread lives in the thread's timeline, not the room's, so the lightbox now steps through that thread's images. A thread root is part of the main timeline and still navigates the room's images.

Adds unit tests for NavigableImageViewDialog and Playwright tests for SVG images and thread navigation.
@dbkr

dbkr commented Nov 19, 2026

Copy link
Copy Markdown
Member

Thanks: @kcfancher if you are able to make a shared component version of this, it would make it much more aligned with the direction of the code.

A view that shows previous/next buttons beside the lightbox image, driven by a view model. The buttons are disabled while the previous image is being loaded, and focus stays inside the view when the focused button disappears.
The navigation state and timeline pagination move out of NavigableImageViewDialog into a view model, and ImageView renders the shared LightboxNavigationView in place of its own buttons.

Behaviour changes along the way:
- The last page of history is now reachable
- "Previous" no longer jumps to the oldest image after paginating
- Failures to load older history are logged instead of swallowed
- Arrow keys are always handled while navigation is shown
@kcfancher

Copy link
Copy Markdown
Author

@dbkr I just pushed up those changes, I also included a commit adding support for navigating a threads images in the lightbox.

@dbkr dbkr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, have given it a proper look through. Basically looks okay, just some things that need fixing up.

@kcfancher
kcfancher requested a review from dbkr November 30, 2026 15:53

This branch was successfully deployed

4 active (1 outdated) deployments
EndToEndTests — e89b645e Deployed Dec 1, 2026 by github-actions[bot]
Netlify — e89b645e Deployed Dec 1, 2026 by github-actions[bot]
SharedComponentStorybook — e89b645e Deployed Dec 1, 2026 by github-actions[bot]
VitestReport — 497242b6 Deployed Oct 18, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-Enhancement Z-Community-PR Issue is solved by a community member's PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

buttons to jump back and forth through pics when in lightbox viewer

7 participants