themesberg / themesberg/flowbite-react

Programatically Scroll Modal.Body to the top

Open
#1,275 1 comment 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.