-
Notifications
You must be signed in to change notification settings - Fork 375
docs(popover): fix appendTo where popovers are hidden #8802
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
Conversation
|
Preview: https://patternfly-react-pr-8802.surge.sh A11y report: https://patternfly-react-pr-8802-a11y.surge.sh |
nicolethoen
left a comment
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.
This does fix the problem - i'm just a little torn.
Ideally, we'd always want popovers to be appended inline, primarily for accessibility reason, so that the popover is as close to its trigger as we can get it in the DOM.
Popovers are supposed to be smart enough to recognize when there is not enough space for them to display themselves and reposition themselves. But I recognize that this is a weird case where the sidebar is overhanging a large margin and I don't know if the popover is smart enough to recognize that something is overhanging it.
I wonder if this is something that the popper has managed to solve and just are not leveraging correctly?
|
We can instead of change the |
|
I think the side effects of lowering the z-index of the sidebar or increasing the z-index of the page section would be pretty great. I don't think we can do that. Likely if we cannot make the Popover smart enough to know that the sidebar is obscuring it and to reposition itself, then changing the Maybe we could change the z-index of the popover in this specific example? |
|
Since the popover (before this pr) is appended to the main section it cant have a higher z-index than the side bar |
|
Curious if @thatblindgeye or @tlabaj have an opinion. |
|
Yeah this is tricky. Looking at it, another option might be updating these examples (probably all of them to be consistent) so that the style prop on the containing div is, Adding Main concern with having examples append to the document body is making sure we explain when it might be needed, and also explaining what else the consumer needs to do when doing so (probably only when they might also be utilizing the shouldOpen and shouldClose props as well). That would probably live in the a11y docs and would be needed anyway, though. |
|
I've looked at Popper code and it seems that it tries to get an 'offset parent' to calculate the x and y offsets from that. It might be a place we can adjust to account for other elements that aren't direct ancestors like the sidebar but I'm not 100% sure. My other thought since it is the auto-width prop that seems to cause this issue is that the position is getting calculated before the overflow styling is applied which shifts the popper. I agree that adding the wrapping div would be a surefire way to get the styling to work and would give explicit boundaries for the popper, but we'd definitely need the extra documentation around usage. What also might work is to adjust the z-index so the popper sits on top of the sidebar, but that maybe isn't quite the desired behavior and may have collisions with other component z-index props. |
|
Should the documentation for the div wrapper go under the |
|
I think the documentation should go below the If it's needed for every example, we could place a note about our specific use of a wrapper for the examples at the top of the docs right after |
|
I'm not able to reproduce that issue currently (tried Chrome and Firefox), but if it's an issue likely to occur then yeah we might be back to either tinkering with the z-index or appending to document body. @kmcfaul if the z-index of the popper can easily be adjusted, could that just be something we warn about, that the consumer may need to adjust z-indexes depending on their specific use-case? If appending to the document body is the best solution for now, we'd just need the warning about that in a11y docs once they're written (would make sense to provide a warning somewhere on this examples page as well; maybe mentioning other alternatives that should be attempted first, like adjusting z-indexes, adding a wrapper div with position relative, etc). |
|
Thanks for the input, I added some info in the docs hope its clear for users |
|
@MariaAga could you rebase this with the latest on v5? It will fix the styles in the generated preview here and make it easier to review. |
|
rebased, test failure is not related to this pr |
|
you're right! a change just merged to fix that test. |


What: Closes #8689