Skip to content

[BUG] ReactTooltip isn't being rendered in Shadow DOM mode #1029

@dsternlicht

Description

@dsternlicht

Describe the bug
My React app is being rendered in a Shadow DOM, ReactTooltip isn't working. If I'm disabling the Shadow DOM mode, it's working as expected.

Version of Package
v5.13.1

To Reproduce

  • App.tsx
import { Tooltip as ReactTooltip } from 'react-tooltip';
import { StyledDiv } from './styles';

export const App = () => {
	return (
		<StyledDiv>
			<ReactTooltip
				id={`my-tooltip`}
				style={{ zIndex: 100, maxWidth: 300, fontSize: 13 }}
			/>
		</StyledDiv>
	);
};
  • index.tsx
const shadowRoot = document.body.attachShadow({ mode: 'open' });
	
// create a root inside the shadow
const root = ReactDOM.createRoot(shadowRoot);

// Render the new widget
root.render(<App />);

Expected behavior
Placeholder element should appear in the dom. Tooltips should work.

Desktop (please complete the following information if possible or delete this section):

  • OS: MacOS
  • Browser Chrome
  • Version latest
  • Frameworks React 18.2.0, Next.js 13.1.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions