Skip to content

[Feature] - Vertical Scrolling Update - #176

Merged
meteoratlas merged 5 commits into
mainfrom
feature/vertical-scrolling-update
Nov 25, 2026
Merged

meteoratlas merged 5 commits into
mainfrom
feature/vertical-scrolling-update

Conversation

@meteoratlas

Copy link
Copy Markdown
Contributor

Description

Connected task (Flamingo): https://wethecollective.teamwork.com/app/tasks/27444955

This adds an optional prop to the marquee that enables it to animate vertically. Existing parameters still work as you'd expect (reverse, reduceMotionSpeed, etc).

Solution

I tried to keep the marquee as similar to the existing state as possible. There were multiple references to width that I renamed to size, to be more generic, but nothing that should have impact on the default behaviour. No new markup was introduced, and the CSS for vertical movement is separate from the standard CSS.

Note: I updated several variable names to remove references to width, but left the CSS variable --marquee-width, as there's an (albeit very unlikely) chance this may have been in a calc or something on some implementation of this component.

The downside to a vertical marquee is that the height of elements is a troublesome thing to calculate, compared to width. I ended up settling for requiring the parent of the marquee to have an explicit height, display: flex, and overflow: clip (which is highly suggested). All requirements are noted in the docs.

Additional Notes

Tested standard (horizontal) marquee usage and encountered no issues. Also tested in all major browsers and in the iOS simulator without issue.

Screenshots

Mockup of standard usage (including reverse):

Screen.Recording.2026-11-25.at.12.43.13.PM.mov

Mockup of how this would look similar to the Flamingo setup (setting only width inline on the image elements (and the same image dimensions), and adding max-width: 100% to the images, slides, and marquee, and width: 50% to the containers.

Screen.Recording.2026-11-25.at.12.52.46.PM.mov

@changeset-bot

changeset-bot Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e624c52

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@wethegit/react-marquee Minor

Not sure what this means? Click here to learn what changesets are.

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

Comment thread src/lib/marquee.tsx Outdated
// Divide the container width, by the marquee width and round it up
// to give us the ammount of items needed to fill the container.
let neededAmount = Math.ceil(containerWidth / marqueeWidth) * 2 - 1
let neededAmount = Math.ceil(containerSize / marqueeSize) * 2 - 1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think that a vertical setup can cause neededAmount to grow without limit if the implementing user doesn't set up a fixed height on the parent element and there is no further limiting element. Let's maybe update this to provide a flexible maximum for neededAmount.

Suggested change
let neededAmount = Math.ceil(containerSize / marqueeSize) * 2 - 1
const viewportSize = vertical ? window.innerHeight : window.innerWidth
let neededAmount = Math.min(
Math.ceil(containerSize / marqueeSize),
Math.ceil(viewportSize / marqueeSize)) * 2 - 1

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good suggestion, I've added this to prevent a ton of extra slides from being generated in that circumstance.

Comment thread src/lib/marquee.tsx Outdated
setDuration(marqueeWidth / speedAmount)
setDuration(marqueeSize / speedAmount)
}
}, [prefersReducedMotion, reducedMotionSpeed, speed])

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That lint error is also the cause of a strange side effect error. Let's ypdate these deps to include vertical and move getRelevantDimensions into the callback.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done, thanks.

@meteoratlas
meteoratlas requested a review from liamegan November 25, 2026 20:33
@meteoratlas
meteoratlas merged commit 718c866 into main Nov 25, 2026
6 checks passed
@github-actions github-actions Bot mentioned this pull request Nov 25, 2026
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.

3 participants