Skip to content

Commit

Permalink
Add repro for #2184
Browse files Browse the repository at this point in the history
  • Loading branch information
siddharthkp committed Jul 28, 2022
1 parent 5ff5bb8 commit 8e91053
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/stories/AnchoredOverlay.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, {useEffect, useRef, useState} from 'react'
import {Meta} from '@storybook/react'

import {BaseStyles, Box, ThemeProvider} from '..'
import {BaseStyles, Box, ThemeProvider, Button} from '..'
import Heading from '../Heading'
import DropdownButton from '../deprecated/Button'
import {AnchoredOverlay} from '../AnchoredOverlay'
Expand Down Expand Up @@ -115,3 +115,25 @@ export const PortalInsideScrollingElement = () => {
</HeaderAndLayout>
)
}

// repro for https://github.com/primer/react/issues/2184
export function ScrollTest(): JSX.Element {
const [isOpen, setIsOpen] = useState(false)

return (
<>
<div style={{overflow: 'scroll', height: '400px', background: 'lightgray'}}>
<div style={{height: '600px', padding: '40px'}}>
<AnchoredOverlay
renderAnchor={anchorProps => <Button {...anchorProps}>Click me to open</Button>}
open={isOpen}
onOpen={() => setIsOpen(true)}
onClose={() => setIsOpen(false)}
>
<Box sx={{p: 4}}>Anchored Content</Box>
</AnchoredOverlay>
</div>
</div>
</>
)
}

0 comments on commit 8e91053

Please sign in to comment.