You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[EuiDatePicker] Fix display in overflow containers #3476
Currently EuiDatePicker does not work properly when places e.g. in a Modal where it doesn't have enough space. Instead it will just cause it's parent overflow: auto container to scroll:
It would be nice if it would be able to be used in these scenarios too.
Digging a bit in the code, it seems there are basically two ways this could potentially work:
Use properties passed to popper (the library used by react-datepicker) to render the popover to somehow move it into an EuiPortal. I've tried this with code like:
<EuiDatePickerselected={date}onChange={setDate}popperProps={{innerRef: (ref: HTMLElement)=>{if(ref){ref.style.zIndex='9005';}},}}popperContainer={({ children }: {children: React.ReactElement})=>(<>{children&&<EuiPortal>{children}</EuiPortal>}</>)}/>
It seems this basically works, but there are some issues, e.g. the stylings are missing, because the styles currently expect the popover to be a child of .euiDatepicker (very solveable problem). There are also more tricky problems, e.g. switching month in the calendar will now hide the calendar because of an exception. I think this might be due to outside click handlers on the popover being broken by the EuiPortal.
Activity
timroes commentedon May 13, 2020
Digging a bit in the code, it seems there are basically two ways this could potentially work:
popper(the library used byreact-datepicker) to render the popover to somehow move it into an EuiPortal. I've tried this with code like:It seems this basically works, but there are some issues, e.g. the stylings are missing, because the styles currently expect the popover to be a child of
.euiDatepicker(very solveable problem). There are also more tricky problems, e.g. switching month in the calendar will now hide the calendar because of an exception. I think this might be due to outside click handlers on the popover being broken by the EuiPortal.react-datepickerwith inline rendering inside the popover. This sounds to me like the more stable approach. It also seemsreact-datepickerdoesn't have too much magic on the input control it renders (https://github.com/Hacker0x01/react-datepicker/blob/master/src/index.jsx#L823) that would need to be recreated.thompsongl commentedon May 13, 2020
I think Option 2 is the right approach. A similar method is used for
EuiSuperDatePicker[-]Make EuiDatePicker work in overflow containers[/-][+][EuiDatePicker] Fix display in overflow containers[/+]eko234 commentedon Nov 3, 2021
EuiSuperDatePicker works well in this regard, isn't it about time to fix this one?
cchaos commentedon Nov 3, 2021
Thanks for the ping. We're currently working on it, but it requires an almost complete refactor because of an outside dependency.
eko234 commentedon Nov 3, 2021
Thanks for your answer, sorry for being rude.