Skip to content

@remotion/studio: Follow active caption in inspector - #11965

Merged
JonnyBurger merged 2 commits into
remotion-dev:mainfrom
snowyukitty:fix/scroll-selected-caption
Oct 5, 2026
Merged

JonnyBurger merged 2 commits into
remotion-dev:mainfrom
snowyukitty:fix/scroll-selected-caption

Conversation

@snowyukitty

@snowyukitty snowyukitty commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Selecting a caption sequence at a later frame leaves the active caption off screen in the inspector. Center that caption on selection, opening the Captions section if needed, then highlight and follow the active token while scrubbing or playing.

Following uses nearest so visible captions stay in place and offscreen captions require only minimal scrolling. Manual inspector scrolling or caption editing pauses following until the next seek or sequence selection; the highlight continues to update. Use the committed sequence-local clock for nested playback rates, trim offsets, freezes, and loops, and wait for committed draft rows when captions arrive after the inspector mounts.

Keep frame updates in a small component beside the memoized caption editor. Update the highlight and scroll position imperatively when the active caption changes or following resumes, without adding React state or frame subscriptions to the list.

Fixes #11897.

Validation:

  • bun run build: 81 tasks passed.
  • bun run stylecheck.
  • Studio's existing tests: 735 passed; 0 failed.
  • Verified initial centering, nearest following during playback and scrubbing, steady scrolling within a token, manual-scroll and editing pauses, and resuming on seek in the running Studio.
  • React Scan: the caption editor rendered 0 times during a three-seek capture, compared with 5 renders before memoization.

No test files were added or changed.

@vercel

vercel Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
bugs Ready Ready Preview Oct 5, 2026 9:07am UTC
remotion Ready Ready Preview Oct 5, 2026 9:07am UTC

Request Review

@pullfrog pullfrog 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.

✅ No new issues found.

Reviewed changes

Selecting a captioned sequence now scrolls the matching caption row into view in the inspector, based on the sequence-local playhead frame rather than the composition frame.

  • TSequence.getCurrentFrame — new optional getter for the committed sequence-local clock, registered by Sequence from a ref synced in a useLayoutEffect.
  • InlineCaptionInspector.onCaptionsRendered — notifies the parent after draft caption rows commit while the section is expanded, so the reveal can wait for runtime captions that arrive after mount.
  • InspectorSequenceSection reveal logic — resolves the active caption from the sequence frame (getter first, then the existing timeline formula with sequenceFrameOffset), expands the Captions section, and consumes the scroll once per selection so seeking, playback, and caption edits keep the user's scroll position.
  • SequenceSelectionInspector — threads track.sequenceFrameOffset into the section.

The reveal guards, effect ordering, and reference-equality consumption all check out against the surrounding code: selectedItems is a stable snapshot, the caption inputs render independently of the transforms group's collapsed state, and the handledCaptionSelection/pendingCaptionScroll refs make the reveal idempotent and self-clearing.

ℹ️ Scope of the new core surface

The behavior is Studio-only, but the support for it lives in packages/core: getCurrentFrame is added to the exported TSequence (via Internals) and Sequence runs a useLayoutEffect on every render in every environment, including headless rendering. This is mergeable as-is — just flagging the core/render-time surface expansion in case you'd prefer the getter and its ref sync scoped to the Studio environment.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash | 𝕏

@JonnyBurger JonnyBurger changed the title fix(studio): Scroll selected captions into view in the inspector @remotion/studio: Scroll active caption into view when selecting a sequence Oct 5, 2026
@JonnyBurger JonnyBurger changed the title @remotion/studio: Scroll active caption into view when selecting a sequence @remotion/studio: Follow active caption in inspector Oct 5, 2026
@JonnyBurger

Copy link
Copy Markdown
Member

Thanks!

@JonnyBurger
JonnyBurger merged commit 80f73c7 into remotion-dev:main Oct 5, 2026
18 checks passed

This branch was successfully deployed

2 active deployments
Preview – remotion — 1c2a7ebf Deployed Oct 5, 2026 by vercel[bot]
Preview – bugs — 1c2a7ebf Deployed Oct 5, 2026 by vercel[bot]
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.

Selecting a caption should scroll to the right section in the inspector panel

2 participants