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

Converting To Blocks Looses Existing Anchor Tag Parameters #4498

Closed
2 tasks
ChrisEdwardsCE opened this issue Jan 16, 2018 · 3 comments
Closed
2 tasks

Converting To Blocks Looses Existing Anchor Tag Parameters #4498

ChrisEdwardsCE opened this issue Jan 16, 2018 · 3 comments
Assignees
Labels
[Feature] Paste [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Milestone

Comments

@ChrisEdwardsCE
Copy link

Issue Overview

When converting an existing post to blocks, all anchor tag parameters are lost (with the exception of href). For example, target="_blank" is removed and also rel="nofollow" is removed. When converting to blocks, all existing HTML for an anchor tag should remain during a conversion to blocks.

Steps to Reproduce (for bugs)

  1. Have an anchor tag in an unconverted HTML block with taget="_blank" or rel="nofollow"
  2. Convert to blocks
  3. View as HTML
  4. Notice the target and rel have been removed.

Expected Behavior

When converting to blocks, all existing HTML for an anchor tag should remain during a conversion to blocks.

Current Behavior

When converting an existing post to blocks, all anchor tag parameters are lost (with the exception of href). For example, target="_blank" is removed and also rel="nofollow" is removed.

Possible Solution

Screenshots / Video

Related Issues and/or PRs

Todos

  • Tests
  • Documentation
@mkaz
Copy link
Member

mkaz commented Apr 5, 2018

I also noticed converting from Classic Post to Blocks also loses class names.

Test

Create Classic Post with:

<p class="foo"> This is my foo paragraph. </p>

<table class="bar"> 
<tr><td> Foo </td><td> Bar </td></tr>
</table>

Open post in editor and convert to blocks, both class names are lost.

@afercia
Copy link
Contributor

afercia commented Jul 13, 2018

Well also other attributes, for example ARIA roles and properties, get stripped out. For example, this:

Some text
<div role="aside">something here</div>
<span aria-hidden="true">hidden from AT</span>

is converted to:

<p>Some text something here
</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>hidden from AT</p>
<!-- /wp:paragraph -->

Maybe time to rename this issue 🙂

@pento
Copy link
Member

pento commented Jul 25, 2018

I've closed this issue with #8125, as that addresses the target and rel attributes.

For the broader issue of howe we manage miscellaneous attributes (eg, ARIA), let's continue the conversation on #6878.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Paste [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

7 participants