themesberg / flowbite

Open-source UI component library and front-end development framework based on Tailwind CSS

Home Page:https://flowbite.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

Bartnormal opened this issue · comments

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

  • Browser: Safari, Chrome, Firefox on mobile devices
  • Operating System: iOS, Android

Additional Information

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

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.

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

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.