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

Dropdowns don't move on scroll #8300

Closed
stefan-schweiger opened this issue Nov 23, 2017 · 9 comments
Closed

Dropdowns don't move on scroll #8300

stefan-schweiger opened this issue Nov 23, 2017 · 9 comments

Comments

@stefan-schweiger
Copy link

Version

2.13.10

Environment

Windows 10, Chrome 61

Reproduction link

https://codepen.io/anon/pen/jaxdMz?&editors=001

Steps to reproduce

Put a Component with a Dropdown(e.g. DatePicker, Select) in an element with overflow which can be scrolled.

What is expected?

The Dropdown should move with the Component on Scroll.

What is actually happening?

When you scroll inside the element with the mouse wheel the Component itself moves as expected but the Dropdown stays in the same place.

Before Scroll:
datepicker

After Scroll:
datepickerscrollbroken

@afc163
Copy link
Member

afc163 commented Nov 23, 2017

#3438

@afc163 afc163 closed this as completed Nov 23, 2017
@afc163
Copy link
Member

afc163 commented Nov 23, 2017

Duplicate of #8268

@afc163 afc163 marked this as a duplicate of #8268 Nov 23, 2017
@stefan-schweiger
Copy link
Author

@afc163 I've tried to set the popup container to every element I can think of but the scroll behavior is still broken.

Example with getPopupContainer:
https://codepen.io/anon/pen/OOZqyw?editors=0010

@stefan-schweiger
Copy link
Author

@afc163 This still is making problems with every element I use, can you provide any help as to what I'm supposed to set the PopupContainer to?

@afc163
Copy link
Member

afc163 commented Dec 21, 2017

https://codesandbox.io/s/4j168r7jw0

@stefan-schweiger
Copy link
Author

stefan-schweiger commented Dec 21, 2017

@afc163 Thanks, but this works only for Select but not for the DatePicker component

https://codesandbox.io/s/mmw6qqrmq8

@afc163
Copy link
Member

afc163 commented Dec 21, 2017

https://ant.design/components/date-picker/#API

DatePicker has a different prop name: getCalendarContainer

@stefan-schweiger
Copy link
Author

stefan-schweiger commented Dec 27, 2017

@afc163 Thank you very much, I must have overlooked that one.

But is there any reason getCalendarContainter and getPopupContainer don't default to a function which gets the next parent element with a scrollbar? This is what I'm using right now and it works as expected:

getScrollParent(node) {
   if (node.parentElement === null) {
       return node;
   }

   return node.parentElement.scrollHeight > node.clientHeight
       || node.parentElement.scrollWidth > node.clientWidth
            ? node.parentElement
            : getScrollParent(node.parentElement);
}

@oneshubh
Copy link

@afc163 I've tried to set the popup container to every element I can think of but the scroll behavior is still broken.

Example with getPopupContainer:
https://codepen.io/anon/pen/OOZqyw?editors=0010

use "getCalendarContainer" for datePicker

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

3 participants