YoastSEO.js icon indicating copy to clipboard operation
YoastSEO.js copied to clipboard

Keyword density eye marker changes image HTML code

Open monbauza opened this issue 7 years ago • 7 comments

Please give us a description of what happened.

When the Caption and Alt Text of an image are the same and contain the focus keyword, the density keyword eye marker makes the caption to disappear and changes the Alt Text to ""<yoastmark". In particular, the image HTML code of the image changes from

[caption id="attachment_249065" align="alignnone" width="450"]<a href="http://my-domain.com/attachment-page/" rel="attachment wp-att-249065"><img class="size-full wp-image-249065" src="http://my-domain.com/wp-content/uploads/2018/09/image.png" alt="this is my focus keyword" width="450" height="286" /></a> this is my focus keyword[/caption]

to

<a href="http://my-domain.com/attachment-page/" rel="attachment wp-att-249065"><img class="size-full wp-image-249065" src="http://my-domain.com/wp-content/uploads/2018/09/image.png" alt="&quot;&lt;yoastmark" /></a>

Please describe what you expected to happen and why.

The eye marker to not modify the image HTML code when highlighting focus keywords in the text.

How can we reproduce this behavior?

  1. Create a new post
  2. Define a focus keyword, add text and make sure the focus keyword appears several times in the text
  3. Add an image to the post whose Caption and Alt Text are the same and contain the focus keyword (see image one below)
  4. Switch to Visual tab and click on the keyword density eye marker (see image two below)
  5. Note that the caption of the image disappears and the image HTML code changes as described above.

Image one image

Image Two image

Technical info

  • WordPress version: 4.9.8
  • Yoast SEO version: 8.2
  • If relevant, which editor is affected (or editors):
  • [x] Classic Editor
  • [ ] Gutenberg
  • [ ] Classic Editor plugin

monbauza avatar Sep 21 '18 08:09 monbauza

Please inform the customer of conversation # 424183 when this conversation has been closed.

monbauza avatar Sep 21 '18 08:09 monbauza

Please inform the customer of conversation # 426352 when this conversation has been closed.

monbauza avatar Sep 21 '18 08:09 monbauza

I am currently affected by this error aswell. Will there be any fix in the near future. Is there any reason this issue has no assignee yet?

TravelTrexIT avatar Oct 02 '18 15:10 TravelTrexIT

The problem occurs under the following conditions:

  • the alt-tag text includes an exact match of the keyphrase

AND

  • the alt-tag text is equal to or includes the caption text or another sentence from the text with an exact match of the keyphrase.

This is a known bug and it will be fixed by the new HTML parser.

Until the bug is not fixed, we can advise the users to specify alt-tags which are not copies of caption texts or sentences from the main text, or which do not contain exact matches of the keyphrase to avoid their HTML being broken by the highlights.

nataliashitova avatar Nov 08 '18 16:11 nataliashitova

Please inform the customer of conversation # 596315 when this conversation has been closed.

rmarcano avatar Mar 24 '20 18:03 rmarcano

A user reported the same issue: https://wordpress.org/support/topic/if-highlite-this-result-in-text-is-clicked-all-captions-are-gone/#post-13291118

Jerparx avatar Aug 21 '20 06:08 Jerparx

Issue happens with v14.8 of Yoast and 5.5 of WordPress and 1.6 of Classic Editor

Pcosta88 avatar Aug 24 '20 14:08 Pcosta88