-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Description
The API used by the current Layer implementation: unstable_renderSubtreeIntoContainer has a number of problems.
- 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))
- It does not support the new context
- 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.