Skip to content

regression: audio attachment duration is not shown until playback - #41599

Merged
dionisio-bot[bot] merged 5 commits into
release-8.7.0from
regression/audio-attachment-duration-not-shown
Jul 31, 2026
Merged

regression: audio attachment duration is not shown until playback#41599
dionisio-bot[bot] merged 5 commits into
release-8.7.0from
regression/audio-attachment-duration-not-shown

Conversation

@abhinavkrin

@abhinavkrin abhinavkrin commented Jul 28, 2026

Copy link
Copy Markdown
Member

Proposed changes (including videos or screenshots)

Audio attachments displayed 00:00 as their length until playback started; the duration only appeared once the file began playing.

Root cause: the persistent audio player (#41120) replaced the previous fuselage <AudioPlayer preload="metadata"> (which loaded each attachment's metadata on mount and showed its length) with a single app-wide <audio> element. That shared element only knows the duration of the one track it currently holds, so every non-active attachment was rendered with a hardcoded duration of 0.

Changes:

  • Add a useMediaDuration hook that resolves a file's duration from its metadata off a detached, metadata-only media element, without playing it, restoring the pre-shared-player behavior.
  • Resolve the duration once per source and cache it for the session, so scrolling an attachment out of and back into the virtualized message list does not re-fetch metadata or flash 00:00.
  • Show the resolved duration for non-active attachments and the player's live duration for the active one.

Issue(s)

CORE-2476

Steps to test or reproduce

  1. Open a room containing one or more audio attachments.
  2. Observe each attachment's length before playing it.
  3. Expected: the total duration appears once metadata loads, without requiring playback (previously it showed 00:00 until play started).

Further comments

Root cause: #41120

CORE-2476

CORE-2477

Review in cubic

Summary by CodeRabbit

  • New Features
    • Audio attachments can now determine and display their duration before playback begins.
  • Bug Fixes
    • Audio duration displays remain accurate when metadata is initially unavailable or when switching tracks.
    • Invalid or unavailable duration values no longer appear in the player.
  • Tests
    • Added coverage for duration loading, caching, source changes, invalid values, and cleanup.

@abhinavkrin
abhinavkrin requested a review from a team as a code owner July 28, 2026 13:12
@dionisio-bot

dionisio-bot Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Looks like this PR is ready to merge! 🎉
If you have any trouble, please check the PR guidelines

@changeset-bot

changeset-bot Bot commented Jul 28, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 87cf48f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds useMediaDuration to resolve and cache audio metadata durations. Uses the result as a fallback for AudioPlayerControls in AudioAttachment.

Changes

Audio duration fallback

Layer / File(s) Summary
Media duration resolution and validation
apps/meteor/client/components/message/content/attachments/file/hooks/useMediaDuration.ts, apps/meteor/client/components/message/content/attachments/file/hooks/useMediaDuration.spec.ts
Loads and caches finite positive durations, cleans up metadata requests, and tests resolution, caching, source changes, and unmount behavior.
Attachment duration integration
apps/meteor/client/components/message/content/attachments/file/AudioAttachment.tsx
Uses the resolved duration when active playback duration is unavailable or the attachment is inactive.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant AudioAttachment
  participant useMediaDuration
  participant AudioElement
  participant AudioPlayerControls
  AudioAttachment->>useMediaDuration: request duration for src
  useMediaDuration->>AudioElement: load metadata
  AudioElement-->>useMediaDuration: emit duration metadata
  useMediaDuration-->>AudioAttachment: return resolvedDuration
  AudioAttachment->>AudioPlayerControls: pass active or resolved duration
Loading

Possibly related PRs

Suggested labels: type: bug

Suggested reviewers: cardoso, gabriellsh

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: fixing audio attachment durations that remain hidden until playback.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Fix failing CI checks

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • CORE-2476: Request failed with status code 401

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@abhinavkrin abhinavkrin added this to the 8.7.0 milestone Jul 28, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@apps/meteor/client/components/message/content/attachments/file/hooks/useMediaDuration.ts`:
- Around line 6-17: Update the useMediaDuration state/effect flow so duration is
reset to the default value whenever src changes, including empty or uncached
sources, before attempting the durationCache lookup. Preserve cached-duration
restoration for valid cached sources and ensure stale duration from the previous
attachment cannot remain visible if metadata loading fails.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4e87f350-8f90-421d-99c9-76a852e9c223

📥 Commits

Reviewing files that changed from the base of the PR and between 987f8d6 and 76f49c5.

📒 Files selected for processing (2)
  • apps/meteor/client/components/message/content/attachments/file/AudioAttachment.tsx
  • apps/meteor/client/components/message/content/attachments/file/hooks/useMediaDuration.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (5)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: Hacktron Security Check
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation

Files:

  • apps/meteor/client/components/message/content/attachments/file/hooks/useMediaDuration.ts
  • apps/meteor/client/components/message/content/attachments/file/AudioAttachment.tsx
🧠 Learnings (6)
📚 Learning: 2026-02-10T16:32:42.586Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 38528
File: apps/meteor/client/startup/roles.ts:14-14
Timestamp: 2026-02-10T16:32:42.586Z
Learning: In Rocket.Chat's Meteor client code, DDP streams use EJSON and Date fields arrive as Date objects; do not manually construct new Date() in stream handlers (for example, in sdk.stream()). Only REST API responses return plain JSON where dates are strings, so implement explicit conversion there if needed. Apply this guidance to all TypeScript files under apps/meteor/client to ensure consistent date handling in DDP streams and REST responses.

Applied to files:

  • apps/meteor/client/components/message/content/attachments/file/hooks/useMediaDuration.ts
📚 Learning: 2026-05-11T20:30:35.265Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 40480
File: apps/meteor/client/meteor/startup/accounts.ts:59-61
Timestamp: 2026-05-11T20:30:35.265Z
Learning: In Rocket.Chat’s Meteor client code, when calling `dispatchToastMessage` with `{ type: 'error' }`, pass the raw caught error object as `message` without manual normalization. `dispatchToastMessage` is designed to accept `message: unknown` for error toasts, so avoid converting errors to strings (e.g., `String(error)`) or extracting `error.message` before passing them.

Applied to files:

  • apps/meteor/client/components/message/content/attachments/file/hooks/useMediaDuration.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.

Applied to files:

  • apps/meteor/client/components/message/content/attachments/file/hooks/useMediaDuration.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.

Applied to files:

  • apps/meteor/client/components/message/content/attachments/file/hooks/useMediaDuration.ts
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.

Applied to files:

  • apps/meteor/client/components/message/content/attachments/file/hooks/useMediaDuration.ts
  • apps/meteor/client/components/message/content/attachments/file/AudioAttachment.tsx
📚 Learning: 2026-03-27T14:52:56.865Z
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 39892
File: apps/meteor/client/views/room/contextualBar/Threads/Thread.tsx:150-155
Timestamp: 2026-03-27T14:52:56.865Z
Learning: In Rocket.Chat, there are two different `ModalBackdrop` components with different prop APIs. During review, confirm the import source: (1) `rocket.chat/fuselage` `ModalBackdrop` uses `ModalBackdropProps` based on `BoxProps` (so it supports `onClick` and other Box/DOM props) and does not have an `onDismiss` prop; (2) `rocket.chat/ui-client` `ModalBackdrop` uses a narrower props interface like `{ children?: ReactNode; onDismiss?: () => void }` and handles Escape keypress and outside mouse-up, and it does not forward arbitrary DOM props such as `onClick`. Flag mismatched props (e.g., `onDismiss` passed to the fuselage component or `onClick` passed to the ui-client component) and ensure the usage matches the correct component being imported.

Applied to files:

  • apps/meteor/client/components/message/content/attachments/file/AudioAttachment.tsx
🔇 Additional comments (1)
apps/meteor/client/components/message/content/attachments/file/AudioAttachment.tsx (1)

6-6: LGTM!

Also applies to: 58-58, 79-79

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 2 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

@codecov

codecov Bot commented Jul 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.00000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.40%. Comparing base (21edebe) to head (87cf48f).
⚠️ Report is 2 commits behind head on release-8.7.0.

Additional details and impacted files

Impacted file tree graph

@@                Coverage Diff                @@
##           release-8.7.0   #41599      +/-   ##
=================================================
- Coverage          68.42%   68.40%   -0.03%     
=================================================
  Files               4141     4142       +1     
  Lines             158337   158386      +49     
  Branches           28331    28321      -10     
=================================================
- Hits              108346   108341       -5     
- Misses             44856    44909      +53     
- Partials            5135     5136       +1     
Flag Coverage Δ
unit 70.32% <86.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 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.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 1 file (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

@abhinavkrin
abhinavkrin marked this pull request as draft July 28, 2026 14:28
abhinavkrin and others added 4 commits July 30, 2026 19:17
Resolve each audio attachment's duration from its metadata (cached per source) so the length is shown before playback, restoring the pre-shared-player behavior.

Signed-off-by: Abhinav Kumar <abhinav@avitechlab.com>
Signed-off-by: Abhinav Kumar <abhinav@avitechlab.com>
Signed-off-by: Abhinav Kumar <abhinav@avitechlab.com>
@ricardogarim
ricardogarim force-pushed the regression/audio-attachment-duration-not-shown branch from 427e9d0 to 39c8d6e Compare July 30, 2026 22:17
@ricardogarim
ricardogarim marked this pull request as ready for review July 30, 2026 22:20

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 3 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Signed-off-by: Abhinav Kumar <abhinav@avitechlab.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
apps/meteor/client/components/message/content/attachments/file/hooks/useMediaDuration.ts (1)

23-28: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a regression test for cache eviction.

useMediaDuration.spec.ts covers loading, invalid durations, source changes, caching, and cleanup, but it does not exercise the durationCache.size > MAX_CACHE_ENTRIES branch. Resolve 257 unique sources and verify that the oldest source triggers a new metadata request after eviction.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@apps/meteor/client/components/message/content/attachments/file/hooks/useMediaDuration.ts`
around lines 23 - 28, Add a regression test in useMediaDuration.spec.ts that
resolves 257 unique media sources, exceeding MAX_CACHE_ENTRIES, then revisits
the oldest source and verifies it triggers a new metadata request. Reuse the
existing loading, caching, and metadata-request test helpers and keep assertions
focused on eviction behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In
`@apps/meteor/client/components/message/content/attachments/file/hooks/useMediaDuration.ts`:
- Around line 23-28: Add a regression test in useMediaDuration.spec.ts that
resolves 257 unique media sources, exceeding MAX_CACHE_ENTRIES, then revisits
the oldest source and verifies it triggers a new metadata request. Reuse the
existing loading, caching, and metadata-request test helpers and keep assertions
focused on eviction behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: fc99fcf6-3427-4b8a-a49e-1dcef0d4f025

📥 Commits

Reviewing files that changed from the base of the PR and between 39c8d6e and 87cf48f.

📒 Files selected for processing (1)
  • apps/meteor/client/components/message/content/attachments/file/hooks/useMediaDuration.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (5)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: Hacktron Security Check
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build
⚠️ CI failures not shown inline (5)

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ✅ **Has milestone or project**
- ✅ **Valid PR title**
- ✅ **Correct target version**

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ✅ **Has milestone or project**
- ✅ **Valid PR title**
- ✅ **Correct target version**

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ✅ **Has milestone or project**
- ✅ **Valid PR title**
- ✅ **Correct target version**

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ✅ **Has milestone or project**
- ✅ **Valid PR title**
- ✅ **Correct target version**

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ✅ **Has milestone or project**
- ✅ **Valid PR title**
- ✅ **Correct target version**
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation

Files:

  • apps/meteor/client/components/message/content/attachments/file/hooks/useMediaDuration.ts
🧠 Learnings (5)
📚 Learning: 2026-02-10T16:32:42.586Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 38528
File: apps/meteor/client/startup/roles.ts:14-14
Timestamp: 2026-02-10T16:32:42.586Z
Learning: In Rocket.Chat's Meteor client code, DDP streams use EJSON and Date fields arrive as Date objects; do not manually construct new Date() in stream handlers (for example, in sdk.stream()). Only REST API responses return plain JSON where dates are strings, so implement explicit conversion there if needed. Apply this guidance to all TypeScript files under apps/meteor/client to ensure consistent date handling in DDP streams and REST responses.

Applied to files:

  • apps/meteor/client/components/message/content/attachments/file/hooks/useMediaDuration.ts
📚 Learning: 2026-05-11T20:30:35.265Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 40480
File: apps/meteor/client/meteor/startup/accounts.ts:59-61
Timestamp: 2026-05-11T20:30:35.265Z
Learning: In Rocket.Chat’s Meteor client code, when calling `dispatchToastMessage` with `{ type: 'error' }`, pass the raw caught error object as `message` without manual normalization. `dispatchToastMessage` is designed to accept `message: unknown` for error toasts, so avoid converting errors to strings (e.g., `String(error)`) or extracting `error.message` before passing them.

Applied to files:

  • apps/meteor/client/components/message/content/attachments/file/hooks/useMediaDuration.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.

Applied to files:

  • apps/meteor/client/components/message/content/attachments/file/hooks/useMediaDuration.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.

Applied to files:

  • apps/meteor/client/components/message/content/attachments/file/hooks/useMediaDuration.ts
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.

Applied to files:

  • apps/meteor/client/components/message/content/attachments/file/hooks/useMediaDuration.ts
🔇 Additional comments (1)
apps/meteor/client/components/message/content/attachments/file/hooks/useMediaDuration.ts (1)

3-3: LGTM!

@ricardogarim ricardogarim added the stat: QA assured Means it has been tested and approved by a company insider label Jul 31, 2026
@dionisio-bot dionisio-bot Bot added the stat: ready to merge PR tested and approved waiting for merge label Jul 31, 2026
@dionisio-bot
dionisio-bot Bot merged commit 29ce956 into release-8.7.0 Jul 31, 2026
47 of 53 checks passed
@dionisio-bot
dionisio-bot Bot deleted the regression/audio-attachment-duration-not-shown branch July 31, 2026 12:52
@abhinavkrin

abhinavkrin commented Jul 31, 2026

Copy link
Copy Markdown
Member Author

Fixes CORE-2477 as well.

Screen.Recording.2026-07-31.at.6.28.13.PM.mov

ggazzo added a commit that referenced this pull request Jul 31, 2026
…data>

Alternative to the useMediaDuration hook from #41599 that resolves the same
regression (CORE-2476: length not shown until playback), without the extra
hook file, the module-level Map cache, or an imperative `new Audio()` object.

Each attachment renders a hidden `<audio preload='metadata'>` and reads the
length from the native `loadedmetadata` event — the same mechanism the
self-contained fuselage `AudioPlayer` used before the persistent-player
refactor (#41120) dropped the per-message element. React owns the element
lifecycle, so no manual listener wiring or teardown is needed.

Removes useMediaDuration.ts and its spec.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge type: bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants