Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dropdown panels inside a Dialog aren't attached to Dialog #1895

Closed
VonStroheim opened this issue Mar 24, 2021 · 6 comments
Closed

Dropdown panels inside a Dialog aren't attached to Dialog #1895

VonStroheim opened this issue Mar 24, 2021 · 6 comments

Comments

@VonStroheim
Copy link

VonStroheim commented Mar 24, 2021

I'm submitting a ...

[x] bug report
[ ] feature request
[ ] support request

Codesandbox Case
TEST CASE

Current behavior
When rendering Dropdown inside a Dialog, the Dropdown popup panel is not attached to the dialog DOM element, causing it to scroll with the page.

Perhaps not an issue per-se, more like a consequence of "appendTo" that defaults to "body" since 6.2.0, precluding the possibility to avoid the under-the-hood usage of React.createPortal.

Furthermore, it's not possible (to my knowledge) to set "appendTo" pointing to the Dialog DOM element as a workaround before the mount is completed.

Expected behavior
Dropdown panel inside Dialog should be attached to the Dialog DOM element.

Minimal reproduction of the problem with instructions

  1. Put a Dropdown inside a Dialog
  2. Open the Dialog
  3. Open the dropdown and keep the panel open
  4. Scroll the page (it must be long enough to be able to scroll)

(see TEST CASE link above)

  • PrimeReact version:
    ^6.2.1

  • Browser:
    All

@dattebayorob
Copy link

Agreed

@mcandu
Copy link
Contributor

mcandu commented Apr 1, 2021

Could you try to add blockScroll={true} on Dialog component. Like this, https://codesandbox.io/s/primereact-test-forked-hwrmw.

@mcandu mcandu self-assigned this Apr 1, 2021
@VonStroheim
Copy link
Author

Could you try to add blockScroll={true} on Dialog component. Like this, https://codesandbox.io/s/primereact-test-forked-hwrmw.

This is indeed an effective workaround.

On a personal note, I prefer to have reasons for blockScroll={true} that are decoupled from having a dropdown in the dialog, as it causes the scrollbar to disappear so the underlying content slightly jumps when the dialog toggles.

@mcandu mcandu added the Status: Discussion Issue or pull request needs to be discussed by Core Team label Apr 1, 2021
@mcandu
Copy link
Contributor

mcandu commented Apr 1, 2021

We'll talk about what we can do for scrollbar behaviour as a team.

@lzoostaoo
Copy link

lzoostaoo commented Apr 1, 2021

This could be a consequence of (#1875)
return ReactDOM.createPortal(element, this.props.appendTo);
in modals

For dorpdown This caused css issues as dialog dont get its styles from parent.

@mertsincan
Copy link
Member

Hi,

You can use appendTo="self" property of Dropdown on the next version.

Best Regards,

@mertsincan mertsincan removed the Status: Discussion Issue or pull request needs to be discussed by Core Team label Apr 12, 2021
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

No branches or pull requests

5 participants