Skip to content

Re-introduce Portals support  #4849

@cschleiden

Description

@cschleiden

The API used by the current Layer implementation: unstable_renderSubtreeIntoContainer has a number of problems.

  1. It will be deprecated in a future React minor release ([Bug] New Context API does not work with ReactDOM.unstable_renderSubtreeIntoContainer facebook/react#12493 (comment))
  2. It does not support the new context
  3. It looks like a normal React component to consumers, but lifecycle methods behave in a very unexpected way

Just replacing that call with Portals works, but the great thing about portals - events bubble, and everything behaves like it's a single React tree - leads to problems for users who upgrade. Key events in a contextual menu, for example, now bubble up if they are not caught by the focus zone in the menu.

Maybe we can create something like an <EventBoundary> component that prevents that, and that could be used by components that use Layer but don't want the event bubbling behavior.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions