-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
[core] feat(Overlay, Portal): allow portal to stop event propagation #6093
[core] feat(Overlay, Portal): allow portal to stop event propagation #6093
Conversation
* @see https://legacy.reactjs.org/docs/portals.html#event-bubbling-through-portals | ||
* @see https://github.com/palantir/blueprint/issues/6124 | ||
*/ | ||
portalStopPropagationEvents?: Array<keyof HTMLElementEventMap>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adjusted the name of this prop based on the other "portal" props on this interface. I admit it's getting a bit unwieldy and a portalProps
prop might be better, but this is OK for now...
@@ -128,6 +143,14 @@ export class Portal extends React.Component<PortalProps, IPortalState> { | |||
} | |||
return container; | |||
} | |||
|
|||
private addStopPropagationListeners(eventNames?: Array<keyof HTMLElementEventMap>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renamed these functions to be more specific
This should definitely be configurable; I don't want to enable new behavior by default that might break existing applications. There's another question of whether the prop should just be a simple |
…PropagationEvents While preserving new feature added in #6093
Works around facebook/react#11387
Fixes #6124
Checklist
Changes proposed in this pull request:
Currently react have a longstanding issue where portals propagate events up the react tree. This PR allows a list of events to be passed in to prevent propagation through the portal on.
Reviewers should focus on:
Whether or not this should be configurable, or if we should always stopPropagation on events on the portal element.
Screenshot
No user facing changes.