Skip to content

Warn if ReactDOM.createPortal is inside a noscript or other text content tag #13985

Closed
@bloodyowl

Description

@bloodyowl

Do you want to request a feature or report a bug?
bug

What is the current behavior?

When calling ReactDOM.createPortal from within a <noscript />, nothing happens, no error is logged.

ReactDOM.render(
  <noscript>
    {ReactDOM.createPortal("yo", modalNode)}
  </noscript>,
  appNode
);

What is the expected behavior?

Whether:

  • warn that it doesn't work (it worked in the previous version)
  • render the portal

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?

  • React 16.5.0 & more recent
  • Reproducible in every browser

Repro
https://jsfiddle.net/bloodyowl/n5u2wwjg/223296/

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