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

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

Closed
orditeck opened this issue Nov 12, 2016 · 16 comments
Closed
Assignees
Labels
Milestone

Comments

@orditeck
Copy link
Contributor

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.

@jpuri
Copy link
Owner

jpuri commented Nov 12, 2016

Hi @orditeck,

Thanks a lot for the PR. One of the reason that I kept it

and not

is that generated HTML and MarkDown use syntax for

, thus I preferred

in editor also to preserve exact styling of margins.

But

may just work well and also fix the warning. I will merge the PR and check. Thanks a ton 😄

~ Jyoti

@jpuri jpuri closed this as completed in 1992f06 Nov 12, 2016
jpuri added a commit that referenced this issue Nov 12, 2016
@jpuri
Copy link
Owner

jpuri commented Nov 16, 2016

Hello @orditeck,

Thinks got little delayed as I was on vacation. But I have to undo the these changes. The reason being that the generated mark-down and HTML use

tag thus to keep things consistent I would prefer to use

tag in editor also.

Plz share your thoughts about it.

@jpuri jpuri reopened this Nov 16, 2016
@orditeck
Copy link
Contributor Author

orditeck commented Nov 16, 2016

@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.

@jpuri jpuri self-assigned this Dec 5, 2016
@jpuri jpuri added the bug label Dec 5, 2016
@jpuri jpuri added this to the 1.3.0 milestone Dec 5, 2016
@jpuri
Copy link
Owner

jpuri commented Dec 5, 2016

@orditeck: WYSIWYG editor typically use

for normal text paragraphs and I would not prefer to deviate from it also you can see in output

tags are used for paragraphs.

Should I go ahead to close this issue ?

@jpuri
Copy link
Owner

jpuri commented Dec 9, 2016

Closing the issue as there is no response.

@jpuri jpuri closed this as completed Dec 9, 2016
@vhmth
Copy link

vhmth commented Dec 11, 2016

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.

@jpuri jpuri reopened this Dec 12, 2016
@jpuri
Copy link
Owner

jpuri commented Dec 12, 2016

@orditeck , @vhmth : I am convinced about fixing this 😄 . I will redo changes of your pr, thanks a lot @orditeck , @vhmth.

@jpuri jpuri modified the milestones: 1.4.0, 1.3.0 Dec 12, 2016
@vhmth
Copy link

vhmth commented Dec 12, 2016

@bonniecool
Copy link

bonniecool commented Dec 13, 2016

@jpuri I reinstall this package and we still get the warning "Warning: validateDOMNesting(...): < div > cannot appear as a descendant of < p >"

Red warning color is not good for an application. Please tell us if you pursue to continue using "< p >" instead of < div >

Thanks!

@vhmth
Copy link

vhmth commented Dec 13, 2016

@bonniecool look at her comment right above mine.

@bonniecool
Copy link

@vhmth thanks! :-D

@jpuri
Copy link
Owner

jpuri commented Dec 13, 2016

Hey @vhmth, @bonniecool:

These changes are already in develop and I will release this week. I am trying to slow down little on release cycles and releasing only well tested code.

@jpuri
Copy link
Owner

jpuri commented Dec 14, 2016

The fix has been release in in version react-draft-wysiwyg@1.4.0.

@jpuri jpuri closed this as completed Dec 14, 2016
@vhmth
Copy link

vhmth commented Dec 14, 2016

Sweet! Seems like it works. :-)

@bnwan
Copy link

bnwan commented Apr 27, 2017

Just started to use this yesterday and getting the "Calling PropTypes validators..." warning. Any help is apprecaited. Thanks

@jpuri
Copy link
Owner

jpuri commented Apr 27, 2017

@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.

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

No branches or pull requests

5 participants