Skip to content

Emotion and Shadow DOM support #7158

Closed as not planned
Closed as not planned

Description

@cee-chen

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:

Activity

  1. JasonStoltz commented on Sep 11, 2023

    @JasonStoltz
    Contributor

    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.

  2. github-actions commented on Mar 10, 2024

    @github-actions

    👋 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.

  3. added
    stale-issue
    on Mar 10, 2024
  4. github-actions commented on Sep 6, 2024

    @github-actions

    ❌ 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.

  5. added
    stale-issue-closed
    on Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    emotionstale-issuestale-issue-closed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions