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

[Bug]: Layout broken in shadow DOM because some tokens are only set in :root #18240

Open
2 tasks done
kubijo opened this issue Dec 11, 2024 · 0 comments
Open
2 tasks done
Labels

Comments

@kubijo
Copy link
Contributor

kubijo commented Dec 11, 2024

Package

@carbon/react

Browser

No response

Package version

@carbon/react@npm:1.72.0

React version

react@npm:18.3.1

Description

When my React app is compiled and mounted in a shadow-DOM with styles mounted inside the shadow root (for obvious reasons) a lot of layouting is broken due to missing tokens.

I've tracked it down to this snippet that does the trick

// Carbon does this for `:root`, but not `:host`
// and it screws our layout in shadow DOM
:host {
    @include layout.emit-layout-tokens;
}

There was and still is more stuff to handle, like…

…but I felt like this warrants a report since I found out the solution, and it could maybe tight into something you have already going on.

Reproduction/example

Not easily done, but the report describes the root cause and solution

Steps to reproduce

Ditto… repro rather involved, but the solution is to widen any :root scoped selector to include :host too

Suggested Severity

Severity 3 = User can complete task, and/or has a workaround within the user experience of a given component.

Application/PAL

No response

Code of Conduct

@kubijo kubijo changed the title [Bug]: [Bug]: Layout broken in shadow DOM because some tokens are only set in :root Dec 11, 2024
@kubijo kubijo changed the title [Bug]: Layout broken in shadow DOM because some tokens are only set in :root [Bug]: Layout broken in shadow DOM because some tokens are only set in :root Dec 11, 2024
@Gururajj77 Gururajj77 moved this to ⏱ Backlog in Design System Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: ⏱ Backlog
Development

No branches or pull requests

2 participants