Skip to content
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

[Bug] Warning: validateDOMNesting(...): <div> cannot appear as a descendant of <p>. #1312

Open
mathieucaroff opened this issue Dec 24, 2023 · 1 comment

Comments

@mathieucaroff
Copy link

When we want to use useSteps in a component inside a <p> element, we get the following console error:

Warning: validateDOMNesting(...): <div> cannot appear as a descendant of <p>.

See it in this codesandbox's console: https://codesandbox.io/s/infallible-hertz-2yjsj3?file=/src/index.js

Current behavior: The placeholder element produced by useStep is a <div>, which cannot always be inserted in the DOM without triggering the validateDOMNesting error in the console.

Expected behavior: useSteps should not return a <div /> placeholder element since this triggers the aforementioned error. Instead, it could return a <span /> element, which would address this issue.

@mathieucaroff
Copy link
Author

Note: it is possible to ignore console errors programmatically by inserting a piece of code similar to the one below somewhere in your project:

console.error = (function (consoleDotError) {
  return function (...args) {
    if (args[0] && args[0].includes("Warning: validateDOMNesting")) return
    consoleDotError.call(console, ...args)
  }
})(console.error)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant