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

Pasting converts an empty span tag into a non-breaking space. #21904 #1

Open
aaryaag03 opened this issue Oct 22, 2022 · 0 comments
Open

Comments

@aaryaag03
Copy link
Collaborator

Describe the bug
Pasting a copied text whose HTML contains an empty tag converts the tag into a non-breaking space, even if the spaces around (or inside) the tag are normal spaces.

To reproduce
Steps to reproduce the behavior:

  1. Copy a text whose HTML contains an empty , eg. Hello World (Hello World)
  2. Paste it on the editor
  3. Check the console or switch to HTML.
  4. See the processed HTML, in our example Hello World

Expected behavior
As none of the spaces in or around the empty tag are  , the space(s) in the processed HTML should be normal spaces and not  .

Editor version

WordPress version: 5.4
Default block editor
Desktop

OS: iOS
Browser chrome
Version 81
Additional context
The can be either empty or containing a normal space, result is the same. No classes or other attributes are present on the tag.

This issue is kinda nasty as it causes visualization problems on the front, especially on mobile, because the extra  s lead to unexpected text overflows (that can't be mitigated via CSS) and subsequently some strange layout issues and horizontal scrolling.

I've discovered this behavior copy-pasting from random Wikipedia articles to have some rich text dummy content. Strangely enough, the HTML from Wikipedia doesn't contain any empty tags, but the received HTML logged by Gutenberg in the console does.

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