-
Notifications
You must be signed in to change notification settings - Fork 843
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
[EuiPopover] Resolve Positioning Errors When EuiPopover is Nested Inside of EuiFlyout #5155
Conversation
…errors when components the popover are nested inside of containers like EuiFlyout
❌ Author of the following commits did not sign a Contributor Agreement: Please, read and sign the above mentioned agreement if you want to contribute to this project |
Preview documentation changes for this PR: https://eui.elastic.co/pr_5155/ |
Yeah this is a known issues with the popovers #4756 because they are rendered in a Portal (at the bottom of the DOM). We have historically & intentionally kept the z-index high enough to pass over the header for cases where either the popover was triggered from a fixed position element like the header, or when the fixed positioned element isn't taken into account for the popover to adjust it's position. I honestly don't have a good answer to this riddle as with most z-index/portal/fixed position issues it can be completely contextual-based. In these situations I tend to look towards similar native HTML components and how they handle these situations. So for instance a native But it goes further and prohibits the scrolling of the page. I'm not sure we can do this safely because of the possible length of the popover. Where the native element seems to be more controlled by the OS to fit the contents in height: But it also allows covering the actual select input with the options list which we cannot do because for some components like the EuiComboBox we allow for searching. The other option would be auto-closing the popover on scroll, which we've done in EuiComboBox but I've found this to be terribly cumbersome. So really the conclusion is that I'm not sure there's anything we can do about it at the moment without some sort of rewrite of not using Portals. |
You're absolutely right. @chandlerprall also brought up the idea of creating a context specific for scrollable containers. This also isn't something that would be an immediate fix, but something we may think about in the future. |
I think this is definitely an improvement, albeit maybe not as perfect as we'd like. I'd say lets get this is in and continue to iterate. |
…l-euiInputPopover Merging in the latest code from the master EUI repo
Preview documentation changes for this PR: https://eui.elastic.co/pr_5155/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_5155/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 The fix looks good to me. Glad it came down to a simple parameter. I think now we need to be more vocal about it in the docs. The following is a simple suggestion, but maybe even something louder like in the Popover page docs.
…hin the Flyout examples. Added additional documention about the repositionOnScroll prop
Preview documentation changes for this PR: https://eui.elastic.co/pr_5155/ |
…mplicated Flyout example in docs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code changes LGTM!
I think this is definitely an improvement, albeit maybe not as perfect as we'd like. I'd say lets get this is in and continue to iterate.
I agree with this; the positioning context idea sounds cool, too.
When @cchaos gives her approval, go ahead and merge with "Use your administrator privileges ..." option. The CLA checker won't approve, but you're safe to merge.
Preview documentation changes for this PR: https://eui.elastic.co/pr_5155/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 LGTM!
Summary
Issue #1023 raised a positioning error for components that utilize
EuiPopover
when they are nested in containers likeEuiFlyout
.EuiInputPopover
andEuiSuperSelect
were specifically mentioned in the issue. The positioning error caused the popover portion of theEuiInputPopover
andEuiSuperSelect
to scroll with the page and detach from their sibling components.By enabling the positioning event listener on the popover to
useCapture
, the components are no longer split with the user scrolls inside of a container. However, this did bring to light another issue where the popover appears to be on top of theEuiFlyout
header and any additional headers on the page. It doesn't appear to be an issue with the z-index, but it may have to do with the calculation for the absolute positioning inside ofpopover_positioning.ts
.@cchaos @miukimiu do you have a preference on how I should tackle this from a design prospective? Per @chandlerprall there may be quite a few edge cases with this.
EuiInputPopover
Positioning Resolutionhttps://user-images.githubusercontent.com/40739624/132523212-04a20ebe-efbc-454d-8564-fd84fa349117.mov
Checklist
Checked Code Sandbox works for any docs examplesAdded or updated jest tests