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

TooltipInPortal used inside a microfrontend obtains an unstyled (and unstylable) tooltip content #1802

Open
rafa-suarez-itx opened this issue Feb 19, 2024 · 4 comments

Comments

@rafa-suarez-itx
Copy link

Hi,

When you use the TooltipInPortal inside a microfrontend remote, the tooltip was added to the html root level in the shell, and it's impossible to style it from the microfrontend remote.

Would be great to allow the tooltip to be placed where you decide, for example at the microfrontend root level.

I think that can be easily allowed adding an optional property that indicates the place to add the portal.

The following code could be a solution:

from:

export type PortalProps = {
/** Optional z-index to set on the Portal. */
zIndex?: number | string;
/** Content to render in the Portal. */
children: NonNullable<React.ReactNode>;
};

to:

export type PortalProps = {
  /** Optional z-index to set on the Portal. */
  zIndex?: number | string;
  /** Content to render in the Portal. */
  children: NonNullable<React.ReactNode>;
  /** Parent to render the Portal. */
  parent?: React.ReactNode;    // <----------- NEW PROPERTY
};

Also I think this property should have the default value: document.body to maintain the current behaviour and prevent the breaking change.

If you need more information or insights, I'll happy to help you!

Thanks!

@williaster
Copy link
Collaborator

Hey @rafa-suarez-itx thanks for checking out visx and opening the issue. There's an open PR for this issue #1567, it's probably on me to review it as I dropped the ball. But It got far more complex than anticipated because the offset calculation of the tooltip depends on the ref that's used. Would love to land on a simpler implementation if possible.

@rafa-suarez-itx
Copy link
Author

Thank you @williaster ! Do you think that we can achieve the simpler implementation?

@rafa-suarez-itx
Copy link
Author

Hi @williaster do you have some news here? Thanks!

@williaster
Copy link
Collaborator

Sorry I have zero bandwidth to work on this. happy to try and look at a simplified approach if someone is excited to give it a go.

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

No branches or pull requests

2 participants