Skip to content

[Feature]: support rendering in Shadow DOM [Fluent UI React v9] #27759

@layershifter

Description

@layershifter

Library

React Components / v9 (@fluentui/react-components)

Describe the feature that you would like added

I would like to be able to render Fluent UI React v9 components inside Shadow DOM. Currently it's impossible.

Styles rendering

Griffel does not support rendering to ShadowRoot and existing renderer does not work adoptedStyleSheets.

FluentProvider & targetDocument

There is a series of issues related to that, read below.

Portals rendering

TL;DR Portal uses ReactDOM.createPortal() and creates nodes to mount in light DOM i.e. in a host document.

Event listeners binding

TL;DR useClickOutside() and some other hooks use targetDocument to bind event listeners. There hooks should handle shadow roots as a target and bind handlers to proper elements.

Focus indicators

TL;DR We use a custom wrapper to :focus-visible that relies on an element and window references ➡️ focus indicators are not visible inside Shadow DOM.

document.activeElement

Use of document event through targetDocument might be unsafe.

Interop with Fluent v8

Ensure the Fluent v9 implementation works alongside Fluent v8.

Have you discussed this feature with our team

@spmonahan

Additional context

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