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: HTML snippet with spans is rendered vastly different in React than in plain HTML #21543

Closed
mindreframer opened this issue May 21, 2021 · 2 comments
Labels
Resolution: Expected Behavior Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug

Comments

@mindreframer
Copy link

A list of span elements in combination with Tailwind.css styles (any version, CDN / NPM / etc) is rendered very differently in plain HTML vs. React.js code.

Links to code examples:

The current behavior

There are no spaces, the word-wrapping is broken and selecting + copying text results in mangeled text in the clipboard.

The expected behavior

It should behave similarly to the plain HTML version: have spaces, render without strange word-wraps and be properly selectable.

Screenshot:
Screenshot-span-react-bug

@mindreframer mindreframer added the Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug label May 21, 2021
@eps1lon
Copy link
Collaborator

eps1lon commented May 21, 2021

Thanks for the report.

This is intentional behavior of JSX. Though in your particular case undesired. #1643 and #4134 should give you an overview on why this is intended by React.

Ultimately, you can reproduce the HTML behavior with

 <span>In</span>
+{"\n"}
 <span>PARADISE</span>

@eps1lon eps1lon closed this as completed May 21, 2021
@mindreframer
Copy link
Author

@eps1lon Interesting... Thanks for the quick response and the provided workaround!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Expected Behavior Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug
Projects
None yet
Development

No branches or pull requests

2 participants