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

REFACTOR: mv tooltip container out of scroll area #1406

Merged
merged 1 commit into from
Sep 21, 2018

Conversation

stephanwlee
Copy link
Contributor

@stephanwlee stephanwlee commented Sep 6, 2018

Chart tooltip (or all popovers) should render at the body level in order
to prevent clipping from a scrollable area. To be more specific, even
position:fixed can get contained inside a region if it is within a
scrollable region. As a remedy, most tools render popover in children of
body.

To achieve this in a component structure, there are two competing goals:

  1. intuitive component structure (tooltip is a subcomponent chart)
  2. DOM-wise, tooltip should not be nested in chart but should be at body
    level.
    Libraries like React allows such pattern via "tunneling". By manually creating
    an element in the body, we emulated the behavior.

In this commit, we:

  • introduced vz-chart-tooltip that knows how to position
  • applied the new tooltip to scalar-card
  • introduced new positioning, "auto"

Copy link
Contributor

@nfelt nfelt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! Thanks for figuring this out and also getting rid of the inner html stuff while you were at it.

Chart tooltip (or all popovers) should render at the body level in order
to prevent clipping from a scrollable area. To be more specific, even
position:fixed can get contained inside a region if it is within a
scrollable region. As a remedy, most tools render popover in children of
body.

To achieve this in a component structure, there are two competing goals:
1. intuitive component structure (tooltip is a subcomponent chart)
2. DOM-wise, tooltip should not be nested in chart but should be at body
   level.
Libraries like React allows such pattern via "tunneling". By manually creating
an element in the body, we emulated the behavior.

In this commit, we:
- introduced vz-chart-tooltip that knows how to position
- applied the new tooltip to scalar-card
- introduced new positioning, "auto"
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

Successfully merging this pull request may close these issues.

2 participants