Skip to content

feat: shared gallery preview in AttachmentPreviewList#3044

Merged
MartinCupela merged 2 commits intomasterfrom
feat/preview-all-media-attachments-in-composer-gallery
Mar 24, 2026
Merged

feat: shared gallery preview in AttachmentPreviewList#3044
MartinCupela merged 2 commits intomasterfrom
feat/preview-all-media-attachments-in-composer-gallery

Conversation

@MartinCupela
Copy link
Contributor

@MartinCupela MartinCupela commented Mar 23, 2026

Closes REACT-910
Closes REACT-911

🎯 Goal

Bug fix: GlobalModal close order (GlobalModal.tsx)

  • Swapped dialog.close() before onClose() in maybeClose. This prevents a throwing onClose callback (like the original e.stopPropagation() on a fake event) from blocking the
    dialog from closing.

Feature: shared gallery preview in AttachmentPreviewList

  • AttachmentPreviewList.tsx — now owns a single shared Modal + Gallery for all image/video attachments. Builds galleryItems and a previewIndexById lookup in one memo using
    toBaseImageDescriptors. Each image/video preview receives an openPreview callback that sets the initial slide index and opens the modal. Uses local showPreview state with
    open/onClose props on Modal.
  • AttachmentPreviewRoot.tsx — simplified to a pure clickable wrapper. Removed Modal, Gallery, useGlobalModal, and useComponentContext imports. Accepts openPreview callback
    prop; delegates gallery opening entirely to parent.
  • MediaAttachmentPreview.tsx / ImageAttachmentPreview.tsx — added openPreview?: () => void prop, passed through to AttachmentPreviewRoot.

Gallery improvements (Gallery.tsx)

  • Gallery now resolves GalleryUI from the prop, then ComponentContext, then the default — so context-provided GalleryUI overrides work.

Docs: ComponentContext.tsx

  • Updated Gallery and GalleryUI docstrings to clarify the distinction: Gallery is the controller (state + context provider), GalleryUI is the visual presentation.

Other

  • MessageComposer.scss — removed an overflow: hidden rule.
  • Tests — updated Gallery test for the new default rendering behavior; added test for gallery preview opening from attachment previews.

@github-actions
Copy link

github-actions bot commented Mar 23, 2026

Size Change: +460 B (+0.1%)

Total Size: 442 kB

Filename Size Change
./dist/cjs/index.js 237 kB +462 B (+0.2%)
./dist/css/index.css 46.9 kB -2 B (0%)
ℹ️ View Unchanged
Filename Size
./dist/audioProcessing-BbOs2wMd.js 1.32 kB
./dist/cjs/emojis.js 2.96 kB
./dist/cjs/mp3-encoder.js 1.27 kB
./dist/css/v2/emoji-mart.css 1.84 kB
./dist/css/v2/emoji-replacement.css 300 B
./dist/css/v2/index.css 39.4 kB
./dist/css/v2/index.layout.css 22.8 kB
./dist/WithAudioPlayback-TERIQpZ6.js 88.3 kB

compressed-size-action

@codecov
Copy link

codecov bot commented Mar 23, 2026

Codecov Report

❌ Patch coverage is 86.04651% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.46%. Comparing base (a9feb11) to head (a913ba6).
⚠️ Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
...achmentPreviewList/utils/AttachmentPreviewRoot.tsx 66.66% 3 Missing and 1 partial ⚠️
...er/AttachmentPreviewList/AttachmentPreviewList.tsx 92.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3044      +/-   ##
==========================================
+ Coverage   80.31%   80.46%   +0.14%     
==========================================
  Files         561      561              
  Lines       13098    13120      +22     
  Branches     3413     3419       +6     
==========================================
+ Hits        10520    10557      +37     
+ Misses       1912     1903       -9     
+ Partials      666      660       -6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@MartinCupela MartinCupela merged commit f05f47d into master Mar 24, 2026
8 checks passed
@MartinCupela MartinCupela deleted the feat/preview-all-media-attachments-in-composer-gallery branch March 24, 2026 09:50
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