react-draft-wysiwyg: Warning: validateDOMNesting(...): cannot appear as a descendant of
I’m getting this warning.
Warning: validateDOMNesting(...): <div> cannot appear as a descendant of <p>. See DraftEditorContents > p > ... > DraftEditorBlock > div.
The problem is this <p>
here https://github.com/jpuri/react-draft-wysiwyg/blob/master/js/src/components/Editor/index.js#L151

Pull request coming soon.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 16 (9 by maintainers)
Commits related to this issue
- Merge pull request #46 from orditeck/master
Fixes #45 — committed to jpuri/react-draft-wysiwyg
by jpuri 8 years ago
Most upvoted comments
I’m getting this warning.
Warning: validateDOMNesting(...): <div> cannot appear as a descendant of <p>. See DraftEditorContents > p > ... > DraftEditorBlock > div.
The problem is this <p>
here https://github.com/jpuri/react-draft-wysiwyg/blob/master/js/src/components/Editor/index.js#L151
Pull request coming soon.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 16 (9 by maintainers)
Commits related to this issue
- Merge pull request #46 from orditeck/master Fixes #45 — committed to jpuri/react-draft-wysiwyg by jpuri 8 years ago
@jpuri I’m sorry but I don’t understand why you want to keep the
<p>
as the main tag. There are multiple<div>
in that<p>
, and it’s not allowed, which is why this warning is showing.Is there any reason for this? 'cause otherwise the warning will stay.
@orditeck , @vhmth : I am convinced about fixing this 😄 . I will redo changes of your pr, thanks a lot @orditeck , @vhmth.
@bnwan: which version of editor are you using ? Also, this warning is not fatal - you can ignore for now, we will anyways soon fix it.
Sweet! Seems like it works. 😃
Hey @jpuri I think it’s fine to use
<p>
within the content block, but I think we should definitely not nest divs inside the<p>
tag. This is semantically incorrect and will result in error logs for any application that uses this wonderful library.What issues would result from us transitioning from
<p>
to<div>
or ensuring that<p>
does not nest<div>
s within it? How large would that transition be? If you look at a lib like Medium.js, they use<div>
s and I’m starting to see that it may because of this issue.