themesberg / themesberg/flowbite-react
Programatically Scroll Modal.Body to the top
Open
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.1k
- Forks
- 506
- PR merge metrics
- No merged PRs in 30d
Description
- [ Yes] I have searched the Issues to see if this bug has already been reported
- [Yes ] I have tested the latest version
Summary
I tried:
// reset scroll:
const modalBody = useRef<HTMLDivElement>(null);
useEffect(() => {
if (modalBody.current) modalBody!.current!.scrollTop = 0;
}, [trigger, modalBody]);
...
<Modal.Body
className="p-0 min-h-[300px] aspect-[30/13]"
ref={modalBody}
>...
but ref is not being passed.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Modal.Body component entry point and trace how its ref is handled for the scrollable body. Verify that the supplied ref can reach the body element and confirm the reported programmatic scroll-to-top behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100