Skip to content

World's first open-source, agentic video production system. 12 production pipelines, 100+ tools, 700+ agent skill and production-knowledge files. Turn your AI coding assistant into a full video production studio.

fix(composer): render word separator outside inline-block span in CaptionOverlay (fixes #571) (#613)

Oğuzhan Filizfdcb861ecc1e
diff --git a/remotion-composer/src/components/CaptionOverlay.tsx b/remotion-composer/src/components/CaptionOverlay.tsx
index 0142d682..b7e493a2 100644
--- a/remotion-composer/src/components/CaptionOverlay.tsx
+++ b/remotion-composer/src/components/CaptionOverlay.tsx
@@ -1,3 +1,4 @@
+import React, { Fragment } from "react";
import {
AbsoluteFill,
Sequence,
@@ -110,23 +111,25 @@ const PageRenderer: React.FC<{
const isActive = w.startMs <= currentMs && w.endMs > currentMs;
const isPast = w.endMs <= currentMs;
return (
- <span
- key={`${w.startMs}-${i}`}
- style={{
- // Keep each word unbroken so lines wrap only at word
- // boundaries. For space-delimited text this matches the
- // previous behavior; for CJK it prevents mid-word breaks.
- display: "inline-block",
- whiteSpace: "nowrap",
- color: isActive ? highlightColor : isPast ? color : `${color}99`,
- transition: "none", // CSS transitions forbidden in Remotion
- textShadow: isActive
- ? `0 0 20px ${highlightColor}66, 0 2px 4px rgba(0,0,0,0.5)`
- : "0 2px 4px rgba(0,0,0,0.5)",
- }}
- >
- {w.word}{i < page.words.length - 1 ? wordSeparator : ""}
- </span>
+ <Fragment key={`${w.startMs}-${i}`}>
+ <span
+ style={{
+ // Keep each word unbroken so lines wrap only at word
+ // boundaries. For space-delimited text this matches the
+ // previous behavior; for CJK it prevents mid-word breaks.
+ display: "inline-block",
+ whiteSpace: "nowrap",
+ color: isActive ? highlightColor : isPast ? color : `${color}99`,
+ transition: "none", // CSS transitions forbidden in Remotion
+ textShadow: isActive
+ ? `0 0 20px ${highlightColor}66, 0 2px 4px rgba(0,0,0,0.5)`
+ : "0 2px 4px rgba(0,0,0,0.5)",
+ }}
+ >
+ {w.word}
+ </span>
+ {i < page.words.length - 1 ? wordSeparator : ""}
+ </Fragment>
);
})}
</span>