Skip to content

Component Hover Card does not respect inner containers #1445

Closed
@Pavelas

Description

@Pavelas

Bug report

Current Behavior

At the moment component Hover Card is working only based on the viewport and there are some edge cases where it stops working if we're trying to use it inside inner scrollable containers.

Demo 👀
Screen.Recording.2022-06-03.at.16.49.30.mov

I found a temporary solution, however it does not solve the issue itself:

  1. Add portalled={false} to HoverCard.Content component.
  2. Add z-index: 0 to HoverCard.Content component.
  3. Add background-color as well as z-index: 1 to containers above and below.
Demo 👀
Screen.Recording.2022-06-03.at.16.50.05.mov

As you can see it solves the issue, but this approach leads to another bug. We're losing avoidCollisions and collisionTolerance features. The card itself is being hidden, however it does not avoid collisions anymore and being invisible, the result is bad UX.

Expected behavior

HoverCard component should respect inner container boundaries and try to avoid collisions.

Suggested solution

I guess there are few solutions and I would be more than happy to contribute and fix it by myself, but I am not sure which solution is the best.

  1. Hide HoverCard.Content component on scroll. I am not sure about this one, because we should make sure that we're not scrolling for example inside HoverCard.Content component. Also I am not sure if it should be working like that by default, maybe we should just simply add additional prop?
  2. Add ability to pass the reference of parent container, in this case, HoverCard.Content component would respect container boundaries instead of viewport. I'm not sure if this solution can be easily implemented.
  3. Your suggestions? 💡

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions