Skip to content

Commit

Permalink
Fix RiverStoryScroll disabled bug on narrow viewports (#918)
Browse files Browse the repository at this point in the history
* fix riverstoryscroll disabled bug

* remove debugging

* restore linebreak
  • Loading branch information
rezrah authored Feb 7, 2025
1 parent 5966728 commit 65f7a92
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 7 deletions.
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.

0 comments on commit 65f7a92

Please sign in to comment.