-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Tooltip content should be wrapped in <div> instead of <p> #17344
Comments
@zhigzhen - Thanks for reaching out and submitting this issue. I see you are willing to submit a PR for this request - that is great - Would you mind sharing it with us? @khmakoto - can you review the suggestion posted where the |
#### Pull request checklist - [x] Addresses an existing issue: Fixes #17344 - [x] Include a change request file using $ yarn change #### Description of changes See the issue thread for more context. If a JSX object with a `<div>` other than a string is passed into the content field of a `TooltipHost` / `Tooltip`, the browser will complain with the following error: > Warning: validateDOMnesting(...): `<div>` cannot appear as a descendant of `<p>`... To deal with this error, we should only wrap the object in `<p>` if it is type string, otherwise we can wrap it in a `<div>`
🎉This issue was addressed in #17593, which has now been successfully released as Handy links: |
🎉This issue was addressed in #17593, which has now been successfully released as Handy links: |
🎉This issue was addressed in #17593, which has now been successfully released as Handy links: |
🎉This issue was addressed in #17593, which has now been successfully released as Handy links: |
🎉This issue was addressed in #17593, which has now been successfully released as Handy links: |
🎉This issue was addressed in #17593, which has now been successfully released as Handy links: |
🎉This issue was addressed in #17593, which has now been successfully released as Handy links: |
🎉This issue was addressed in #17593, which has now been successfully released as Handy links: |
🎉This issue was addressed in #17593, which has now been successfully released as Handy links: |
🎉This issue was addressed in #17593, which has now been successfully released as Handy links: |
🎉This issue was addressed in #17593, which has now been successfully released as Handy links: |
🎉This issue was addressed in #17593, which has now been successfully released as Handy links: |
🎉This issue was addressed in #17593, which has now been successfully released as Handy links: |
🎉This issue was addressed in #17593, which has now been successfully released as Handy links: |
🎉This issue was addressed in #17593, which has now been successfully released as Handy links: |
Environment Information
Actual behavior:
If a JSX object with a
<div>
other than astring
is passed into thecontent
field of a TooltipHost / Tooltip, the browser will complain with the following error:Expected behavior:
The browser should not complain because the
content
should be wrapped inside of<div>
instead of<p>
. This change can be made on line 71 here: https://github.com/microsoft/fluentui/blob/master/packages/react/src/components/Tooltip/Tooltip.base.tsxAnother reason for this change, is that
content
field accepts eitherstring
orJSX.Element
so it should account for nested objects within a<div>
when aJSX.Element
is provided.source: https://github.com/microsoft/fluentui/blob/master/packages/react/src/components/Tooltip/Tooltip.types.ts line 33
Priorities and help requested:
Are you willing to submit a PR to fix? Yes
The text was updated successfully, but these errors were encountered: