Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix RiverStoryScroll disabled bug on narrow viewports #918

Merged
merged 3 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/strong-emus-leave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react-brand': patch
---

Fix `RiverStoryScroll` scrolling bug when `disabled={true}`
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,16 @@ Disabled.args = {
disabled: true,
}

export const DisabledNarrow = args => <Disabled withTrailingComponent {...args} />
DisabledNarrow.args = {
disabled: true,
}
DisabledNarrow.parameters = {
viewport: {
defaultViewport: 'iphonexr',
},
}

export const EnterpriseExample = () => (
<RiverStoryScroll>
<River>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ export function RiverStoryScroll({children, disabled}: RiverStoryScrollProps) {
const Children = React.Children.map(children, child => {
if (React.isValidElement(child)) {
return React.cloneElement(child as React.ReactElement<RiverProps>, {
className: clsx(styles['RiverStoryScroll__internal-river'], styles['RiverStoryScroll__content-stack']),
className: clsx(
styles['RiverStoryScroll__internal-river'],
!disabled && styles['RiverStoryScroll__content-stack'],
),
})
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,18 @@ test.describe('Visual Comparison: RiverStoryScroll', () => {
expect(await page.screenshot({fullPage: true})).toMatchSnapshot()
})

// eslint-disable-next-line i18n-text/no-en
test.describe('Mobile viewport test for Disabled Narrow', () => {
test.use({viewport: {width: 360, height: 800}})
test('RiverStoryScroll / Disabled Narrow', async ({page}) => {
await page.goto(
'http://localhost:6006/iframe.html?args=&id=components-riverstoryscroll-features--disabled-narrow&viewMode=story',
)

await page.waitForTimeout(500)
expect(await page.screenshot({fullPage: true})).toMatchSnapshot()
})
})
test('RiverStoryScroll / Enterprise Example', async ({page}) => {
await page.goto(
'http://localhost:6006/iframe.html?args=&id=components-riverstoryscroll-features--enterprise-example&viewMode=story',
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading