You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't know if it's a bug or a feature. If code like this:
functionPortal({ children }){returnReactDOM.createPortal(children,document.body);}<formid="outter_form"onSubmit={e=>xxx}><Portal><formid="inner_form"onSubmit={e=>xxx}><buttontype="submit">submit</button></form></Portal></form>// then the inner_from onSubmit will cause the outter form submit...// I have to add `if (e.target !== e.currentTarget) return;` in outter form's onSubmit to prevent it.
If it's a feature, feel free to close this issue. But I still hope you document it in reactjs.org
The text was updated successfully, but these errors were encountered:
React's Portals documentation does state that events propagate to parents as if the children are still part of the main component tree, even though they pop out of the html one. You can avoid this by calling e.stopPropagation therefore.
example: https://codesandbox.io/s/8plqn8mwl
I don't know if it's a bug or a feature. If code like this:
If it's a feature, feel free to close this issue. But I still hope you document it in reactjs.org
The text was updated successfully, but these errors were encountered: