Bug Description
The Tailwind variants of ScrollVelocity render a literal undefined CSS class on every default usage because parallaxClassName and scrollerClassName have no defaults, while the render path interpolates them into a template string.
Copy-pasting the Tailwind component and rendering it without those two optional props produces:
<div class="undefined relative overflow-hidden">
<div class="undefined flex whitespace-nowrap text-center ...">
This breaks the CONTRIBUTING 4-variant parity rule and contradicts the documented defaults ("parallax" / "scroller" in ScrollVelocityDemo).
Affected files (current main):
src/tailwind/TextAnimations/ScrollVelocity/ScrollVelocity.jsx:38-39,110,112
src/ts-tailwind/TextAnimations/ScrollVelocity/ScrollVelocity.tsx:73-74,145,147
Healthy comparison:
src/content/TextAnimations/ScrollVelocity/ScrollVelocity.jsx:39-40 defaults to 'parallax' / 'scroller' and renders className={parallaxClassName}
src/ts-default/TextAnimations/ScrollVelocity/ScrollVelocity.tsx:74-75 same
Steps to Reproduce
- Use the Tailwind variant:
src/tailwind/TextAnimations/ScrollVelocity/ScrollVelocity.jsx (same for src/ts-tailwind/.../ScrollVelocity.tsx)
- Render with default props only:
<ScrollVelocity texts={['React Bits', 'Scroll Down']} velocity={100} />
- Inspect the DOM (DevTools Elements panel).
- Observe the outer
div class is "undefined relative overflow-hidden" and the inner motion.div class starts with "undefined flex ...".
Minimal logic repro (no browser needed):
let parallaxClassName, scrollerClassName;
console.log(`${parallaxClassName} relative overflow-hidden`);
// -> "undefined relative overflow-hidden"
Expected Behavior
With parallaxClassName / scrollerClassName omitted, no undefined token should appear. Tailwind variants inline their layout utilities (relative overflow-hidden, flex whitespace-nowrap ...), so the custom class portion should default to empty string, e.g. " relative overflow-hidden".
Actual Behavior
Outer: "undefined relative overflow-hidden"
Inner: "undefined flex whitespace-nowrap text-center font-sans text-4xl font-bold tracking-[-0.02em] drop-shadow md:text-[5rem] md:leading-[5rem]"
Tailwind ignores the unknown undefined token, so layout does not fully break, but the DOM is polluted on every default render and the output disagrees with the other two variants and the docs.
Root Cause
Missing defaults in the Tailwind destructuring:
// src/tailwind/TextAnimations/ScrollVelocity/ScrollVelocity.jsx:38-39
parallaxClassName,
scrollerClassName,
vs content:
// src/content/TextAnimations/ScrollVelocity/ScrollVelocity.jsx:39-40
parallaxClassName = 'parallax',
scrollerClassName = 'scroller',
combined with unconditional interpolation:
// src/tailwind/.../ScrollVelocity.jsx:110,112
<div className={`${parallaxClassName} relative overflow-hidden`}>
<motion.div className={`${scrollerClassName} flex ...`}>
undefined stringifies to "undefined". Note the Tailwind variant intentionally does not import ScrollVelocity.css, so defaulting to 'parallax' / 'scroller' (content defaults) would reference non-existent classes; '' is the correct Tailwind default, consistent with className = '' on line 33.
Suggested Fix
In both Tailwind variants, default to empty string:
- parallaxClassName,
- scrollerClassName,
+ parallaxClassName = '',
+ scrollerClassName = '',
Files:
src/tailwind/TextAnimations/ScrollVelocity/ScrollVelocity.jsx:38-39
src/ts-tailwind/TextAnimations/ScrollVelocity/ScrollVelocity.tsx:73-74
No other change needed; docs table (src/demo/TextAnimations/ScrollVelocityDemo.jsx:80-90) documents "parallax" / "scroller" for the CSS variant rendered in the preview and can stay as-is, or add a note that Tailwind defaults to "".
Environment / Version
- Repo:
DavidHDev/react-bits main @ 3a1c7f2 (verified 2026-09-13)
- Browsers: all (DOM string bug, not browser-specific)
- Variants affected:
Tailwind JS, Tailwind TS only; Content JS and TS-Default are healthy
Validations
Bug Description
The Tailwind variants of
ScrollVelocityrender a literalundefinedCSS class on every default usage becauseparallaxClassNameandscrollerClassNamehave no defaults, while the render path interpolates them into a template string.Copy-pasting the Tailwind component and rendering it without those two optional props produces:
This breaks the CONTRIBUTING 4-variant parity rule and contradicts the documented defaults (
"parallax"/"scroller"inScrollVelocityDemo).Affected files (current
main):src/tailwind/TextAnimations/ScrollVelocity/ScrollVelocity.jsx:38-39,110,112src/ts-tailwind/TextAnimations/ScrollVelocity/ScrollVelocity.tsx:73-74,145,147Healthy comparison:
src/content/TextAnimations/ScrollVelocity/ScrollVelocity.jsx:39-40defaults to'parallax'/'scroller'and rendersclassName={parallaxClassName}src/ts-default/TextAnimations/ScrollVelocity/ScrollVelocity.tsx:74-75sameSteps to Reproduce
src/tailwind/TextAnimations/ScrollVelocity/ScrollVelocity.jsx(same forsrc/ts-tailwind/.../ScrollVelocity.tsx)divclass is"undefined relative overflow-hidden"and the innermotion.divclass starts with"undefined flex ...".Minimal logic repro (no browser needed):
Expected Behavior
With
parallaxClassName/scrollerClassNameomitted, noundefinedtoken should appear. Tailwind variants inline their layout utilities (relative overflow-hidden,flex whitespace-nowrap ...), so the custom class portion should default to empty string, e.g." relative overflow-hidden".Actual Behavior
Outer:
"undefined relative overflow-hidden"Inner:
"undefined flex whitespace-nowrap text-center font-sans text-4xl font-bold tracking-[-0.02em] drop-shadow md:text-[5rem] md:leading-[5rem]"Tailwind ignores the unknown
undefinedtoken, so layout does not fully break, but the DOM is polluted on every default render and the output disagrees with the other two variants and the docs.Root Cause
Missing defaults in the Tailwind destructuring:
vs content:
combined with unconditional interpolation:
undefinedstringifies to"undefined". Note the Tailwind variant intentionally does not importScrollVelocity.css, so defaulting to'parallax'/'scroller'(content defaults) would reference non-existent classes;''is the correct Tailwind default, consistent withclassName = ''on line 33.Suggested Fix
In both Tailwind variants, default to empty string:
Files:
src/tailwind/TextAnimations/ScrollVelocity/ScrollVelocity.jsx:38-39src/ts-tailwind/TextAnimations/ScrollVelocity/ScrollVelocity.tsx:73-74No other change needed; docs table (
src/demo/TextAnimations/ScrollVelocityDemo.jsx:80-90) documents"parallax"/"scroller"for the CSS variant rendered in the preview and can stay as-is, or add a note that Tailwind defaults to"".Environment / Version
DavidHDev/react-bitsmain@3a1c7f2(verified 2026-09-13)Tailwind JS,Tailwind TSonly;Content JSandTS-Defaultare healthyValidations
open_issues_count: 0, searchparallaxClassName in:title,body,commentsreturns 0 results, only related closed item is feat: support ReactNode in ScrollVelocity texts prop #907 (ReactNodesupport, unrelated). Recent variant-parity fix fix: correct 48 drifted prop-table defaults and align 4 variant default mismatches #1060 coveredGlitchText/MetaBalls/SideRaysonly, notScrollVelocity.