Fix river breakout tabs custom background - #1375
Conversation
🦋 Changeset detectedLatest commit: cf9c042 The changes in this PR will be included in the next version bump. This PR includes changesets to release 8 packages
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 |
🟢 No design token changes found |
🟢 Bundle size report
|
🟢 Unit test coverage changes foundUnit test coverage has been updated through this PR. Changes: 0 new tests, 0 removed tests, 1 improved, 0 decreased
|
There was a problem hiding this comment.
Pull request overview
Adds a first-class API to RiverBreakoutTabs for rendering a persistent decorative background behind the shared visual region, avoiding the prior ref/DOM-traversal approach and preventing unmounting across tab changes.
Changes:
- Added
backgroundVisualandimagePositionprops toRiverBreakoutTabs, with corresponding rendering + styling changes for both wide (tabs) and narrow (accordion) layouts. - Added unit tests covering the new props in the wide (tab) layout.
- Updated Storybook examples, docs, and a changeset to reflect the new API (plus a small
Herostory styling tweak).
Show a summary per file
| File | Description |
|---|---|
| packages/react/src/river/RiverBreakoutTabs/RiverBreakoutTabs.tsx | Adds backgroundVisual + imagePosition props and renders a background layer behind shared visuals. |
| packages/react/src/river/RiverBreakoutTabs/RiverBreakoutTabs.test.tsx | Adds tests asserting backgroundVisual renders once and modifier classes apply (wide layout). |
| packages/react/src/river/RiverBreakoutTabs/RiverBreakoutTabs.module.css | Adds layering/padding rules and new modifier classes for background + image positioning. |
| packages/react/src/river/RiverBreakoutTabs/RiverBreakoutTabs.module.css.d.ts | Updates generated CSS module typings for the new class names. |
| packages/react/src/river/RiverBreakoutTabs/RiverBreakoutTabs.examples.stories.tsx | Migrates examples from DOM-based background injection to the new backgroundVisual prop. |
| packages/react/src/Hero/Hero.examples.stories.tsx | Adjusts trailing component text styling (variant="muted"). |
| apps/next-docs/content/components/RiverBreakoutTabs/index.mdx | Documents new props in the component props table. |
| .changeset/river-breakout-tabs-background-visual.md | Publishes the new props as a minor change with usage snippet. |
Copilot's findings
- Files reviewed: 7/12 changed files
- Comments generated: 4
🟢 No visual differences foundOur visual comparison tests did not find any differences in the UI. |
danielguillan
left a comment
There was a problem hiding this comment.
This is the right solution, simple and straightforward. Great work @rezrah!
There was a problem hiding this comment.
@jesussandreas Just double checking that the paddings around the visual are correct and also, if there are use cases where we might want to keep the option to make the background span the full width of the page.
There was a problem hiding this comment.
@danielguillan yeah, they look okay too me for the most part. those are very UI dependent as well anyways.

Summary
Resolves https://github.com/github/brand-experience/issues/228
Previously the ref-only approach we recommended had runtime issues. User needed to traverse the dom until they matched the visual child, and this would unmount on tab changes.
Now, a new
backgroundVisualprop on the root renders the custom backdrop once. First class API. No refs needed. No unmounting issue.Also updated the design slightly, because previous version was incorrectly using a full-bleed dither background.
🔗 Preview
List of notable changes:
What should reviewers focus on?
Steps to test:
Contributor checklist:
update snapshotslabel to the PR)Reviewer checklist:
Screenshots: