themesberg / flowbite-react

Official React components built for Flowbite and Tailwind CSS
https://flowbite-react.com
MIT License
1.86k stars 417 forks source link

Modals buggy on mobile #1083

Open reilem opened 11 months ago

reilem commented 11 months ago

Steps to reproduce

I have found multiple issues with the default flowbite-react modals when viewed on mobile. I initially found these issues in my own app and then later discovered they are also broken on the official flowbite-react docs website.

  1. Go to: https://www.flowbite-react.com/docs/components/modal on any browser in mobile
  2. Click on any of the Toggle Modal buttons

Current behavior

IMG_4770

Expected behavior

Context

Environments:

Fix suggestions:

I was able to solve these problems in my app with the following theme override:

theme={{
  root: {
    // Replace: h-modal h-screen with h-full
    base: 'fixed top-0 right-0 left-0 z-50 h-full overflow-y-auto overflow-x-hidden md:inset-0 md:h-full',
  },
  content: {
    // Added: flex flex-col justify-center
    base: 'relative h-full w-full p-4 md:h-auto flex flex-col justify-center',
    // Added: max-h-full max-w-full overflow-hidden
    inner: 'relative rounded-lg bg-white shadow dark:bg-gray-700 flex flex-col',
  },
}}

Hope this helps!

SeungJL commented 8 months ago

Please solve it quickly. The modal cannot be placed. And can the modal height be set automatically? I want to give the style myself, but it doesn't apply.