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

Editor should not remove "empty" (but styled) elements #8878

Closed
salty-horse opened this issue Mar 10, 2018 · 4 comments
Closed

Editor should not remove "empty" (but styled) elements #8878

salty-horse opened this issue Mar 10, 2018 · 4 comments

Comments

@salty-horse
Copy link

This bug is split off from #7932. Could be related to #7920.

Expected behavior

All HTML elements should be kept intact.

Actual behavior

Empty <a> elements are removed, maybe other element types.
Such elements are also silently removed when trying to edit existing posts with the rich text editor, which is bad.

Steps to reproduce the behavior

Enter this <a> element in HTML editing mode (from iTunes' official Link Maker)
<a href="https://itunes.apple.com/us/app/wordpress/id335703880?mt=8" style="display:inline-block;overflow:hidden;background:url(https://linkmaker.itunes.apple.com/assets/shared/badges/en-us/appstore-lrg.svg) no-repeat;width:135px;height:40px;background-size:contain;"></a>

Switch back to the rich text editing mode. The element is gone.

Tested on WPiOS 9.4 (latest)

In general, empty elements should not be removed. Every element can important behavior attached to it, even if it's empty. For example, their contents can be controlled by CSS styles or javascript, and empty tags can still serve as linkable anchors for fragment URLs, used by e.g. a table of contents on the same page.

@stale
Copy link

stale bot commented Mar 12, 2019

This issue has been marked as stale because:

  • It has been inactive for the past year.
  • It isn't in a project or a milestone.
  • It hasn’t been labeled [Pri] Blocker, [Pri] High, or good first issue.

Please comment with an update if you believe this issue is still valid or if it can be closed. This issue will also be reviewed for validity and priority (cc @designsimply).

@stale stale bot added the [Status] Stale label Mar 12, 2019
@salty-horse
Copy link
Author

This is still an issue with version 11.9.
The element doesn't show up in rich text editing mode, and once an actual edit is made in that mode, it is automatically removed.

@stale stale bot removed the [Status] Stale label Mar 12, 2019
@designsimply
Copy link
Contributor

@salty-horse thanks for the issue and comment! We are moving toward a new block editor, so I tested this with 11.9 using Me > App Settings > Use Block Editor enabled and found that the empty a tag you provided as an example is maintained when using the block editor.

Video: 1m34s (tested with WPiOS 11.9 on iPhone 6S iOS 12.1.4)

Because the functionality works as requested in the block editor, I recommend closing this issue and would also like to get a second opinion about that.

@koke
Copy link
Member

koke commented Mar 13, 2019

I can see how that's annoying, but I don't think we can support in Aztec without major changes. The block editor should do a better job of respecting HTML, although it's still based on Aztec for rich text editing, so if you edit the block with that tag it might get corrupted.

I agree with @designsimply, closing this one. Please reopen if you see it happening in the block editor and we'll evaluate options again.

@koke koke closed this as completed Mar 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants