Skip to content

Conversation

@marlier
Copy link

@marlier marlier commented Mar 12, 2024

If the Dialog component is position: fixed but is taller than the viewport, this means that the bottom of the Dialog (which is below the bottom of the viewport) cannot be reached other than by expanding the window, as the Dialog remains fixed in space relative to the viewport. A simple test case for this is to create a Dialog whose DialogBody has content <div className="block h-[4000px]">test</div> or some other similar thing.

Changing the position setting to relative instead allows the Dialog to be scrolled (independent of the page body.

A workaround while this PR is being considered it to set the following theme option:

<ThemeProvider
                  value={{
                    dialog: {
                      styles: {
                        base: {
                          backdrop: {
                            position: 'relative',
                          },
                        },
                      },
                    },
                  }}
                >

…the viewport

If the Dialog component is `position: fixed` but is taller than the viewport, this means that the bottom of the Dialog (which is below the bottom of the viewport) cannot be reached other than by expanding the window, as the Dialog remains fixed in space relative to the viewport.  

Changing the position setting to `relative` instead allows the Dialog to be scrolled, without the body moving.

A workaround while this PR is being considered it to set the following theme option:
```
<ThemeProvider
                  value={{
                    dialog: {
                      styles: {
                        base: {
                          backdrop: {
                            position: 'relative',
                          },
                        },
                      },
                    },
                  }}
                >
```

The Dialog component is currently using floating-ui to handle blanking out the background of the screen, etc, and sets the `lockScroll` property.  `lockScroll` does a number of different things, including hiding the scrollbar on the page and setting `overflow: hidden` on `<body>`.
@vercel
Copy link

vercel bot commented Mar 12, 2024

@marlier is attempting to deploy a commit to the ct-tailwind-team Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

@oleksandr-andrushchenko oleksandr-andrushchenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it will brake whole backdrop positioning, this one is better

fixed overscroll-y-auto overflow-auto

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants