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

Emotion and Shadow DOM support #7158

Closed
cee-chen opened this issue Sep 5, 2023 · 3 comments
Closed

Emotion and Shadow DOM support #7158

cee-chen opened this issue Sep 5, 2023 · 3 comments

Comments

@cee-chen
Copy link
Contributor

cee-chen commented Sep 5, 2023

Problem

Currently, EUI uses several Emotion <Global /> components which inject styles directly into the head:

return <Global styles={styles} />;

return <Global styles={globalStyles(euiTheme)} />;

<Global styles={euiOverlayMaskBodyStyles} />

<Global styles={{ ':root': themeCSSVariables }} />

This head insertion occurs even when EUI is instantiated from the shadow DOM (when styles should instead be inserted into the shadow DOM container)

Solution

We need to do the following:

  1. Either:
    1. Attempt to automatically detect when EuiProvider is instantiated within a shadow context, or
    2. Allow consumers to pass us a prop that says EUI is being used within shadow DOM (my strong preference, as far less will go wrong this way)
  2. Add our own <GlobalOrHost /> component that returns a global if not shadow DOM, and a :host stylesheet/selector if shadow DOM
  3. Require consumers to pass us their Shadow DOM container/root (required for us to append styles to the correct location)

TO INVESTIGATE: Will absolutely or fixed positioned items like headers & flyouts still work as expected? Is the shadow DOM iframe-like in behavior in that regard?

Other resources/reading:

@JasonStoltz
Copy link
Member

We're labeling this as a low priority for now, as nobody has requested shadow DOM support. Please leave a comment if this is important for your use case and we will reconsider.

Copy link

👋 Hi there - this issue hasn't had any activity in 6 months. If the EUI team has not explicitly expressed that this is something on our roadmap, it's unlikely that we'll pick this issue up. We would sincerely appreciate a PR/community contribution if this is something that matters to you! If not, and there is no further activity on this issue for another 6 months (i.e. it's stale for over a year), the issue will be auto-closed.

Copy link

github-actions bot commented Sep 6, 2024

❌ Per our previous message, this issue is auto-closing after having been open and inactive for a year. If you strongly feel this is still a high-priority issue, or are interested in contributing, please leave a comment or open a new issue linking to this one for context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants