themesberg / flowbite

Open-source UI component library and front-end development framework based on Tailwind CSS
https://flowbite.com
MIT License
7.29k stars 708 forks source link

Modal always opens at the top on mobile browsers and page remains at the top after closing #891

Open Bartnormal opened 3 weeks ago

Bartnormal commented 3 weeks ago

Bug Description

When opening a modal on mobile browsers, the page always scrolls to the top. After closing the modal, the page remains at the top instead of returning to the previous scroll position.

Steps to Reproduce

  1. Open a Flowbite demo page on a mobile browser.
  2. Scroll down and open a modal.
  3. Observe that the page scrolls to the top as soon as the modal is opened.
  4. Close the modal.
  5. Observe that the page remains at the top and does not return to the previous scroll position.

Expected Behavior

When opening a modal, the page should remain at the current scroll position. After closing the modal, the page should return to its previous scroll position.

Actual Behavior

The page scrolls to the top when the modal is opened. After closing the modal, the page stays at the top and does not return to the previous position.

Environment

Additional Information

This issue significantly impacts user experience as users lose their place on the page after closing the modal.

Lexachoc commented 3 weeks ago

I tried with iPhone to open this page: https://flowbite.com/docs/components/modal/ with Safari, Chrome, and Arc. It works as expected and does not scroll up to the top.

Bartnormal commented 2 weeks ago

Interesting. I had this problem on my Android device. Is it possible that the body container has to have certain css styles?

Lexachoc commented 2 weeks ago

I just tried it with my Samsung tablet and opened the page with Chrome. Still not seeing this problem. No idea what is causing this problem.

Perhaps someone else can check this out.