Skip to content

[RSP] Components cannot read CSS vars when rendered inside a portal #1697

@eduardo-vargas

Description

@eduardo-vargas

🐛 Bug Report

If V3 components are rendered using ReactDOM.createPortal, the components don't seem to be able to access the CSS variables.

Screen Shot 2021-03-12 at 12 14 32 PM

🤔 Expected Behavior

Components should look and feel the same whether they were rendered using ReactDOM.render or ReactDOM.createPortal

😯 Current Behavior

Components are rendered using browser default styling instead, see codesandbox example

💁 Possible Solution

Not 100% sure :/

🔦 Context

We were trying to render an RSP v3 component within another part of the website that is outside of our react environment / component tree.

💻 Code Sample

codesandbox example

🌍 Your Environment

Software Version(s)
react-spectrum 3.8.0
Browser Chrome Version 89.0.4389.82 (Official Build) (x86_64)
Operating System MacOS Big Sur 11.1

🧢 Your Company/Team

Adobe / Commerce Cloud

🕷 Tracking Issue (optional)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions