axe-core icon indicating copy to clipboard operation
axe-core copied to clipboard

link-in-text-block is inconsistent with < br> elements

Open TobiasG95 opened this issue 1 year ago • 4 comments

Product

axe-core

Product Version

4.8.2

Latest Version

  • [X] I have tested the issue with the latest version of the product

Issue Description

Expectation

The link-in-text-block issue is only raised when the link is included in the text directly. Using an
as a seperator should consistently prevent this issue from being raised.

Actual

On some occasions when the < br> is included in a < a> tag then the issue is raised. If the < br> is placed in front of the < a> tag then it is not raised.

How to Reproduce

Error noticed using the standalone js module on the cards on this page: https://www.stmuv.bayern.de/themen/index.htm

These are the links: image

The link in the left card is not being detected as an issue. This is the html: image <p>Aktuelle Problemlagen untersucht das Bayerische Umweltministerium anhand fundierter wissenschaftlicher Erkenntnisse.<br> <a title="Informationen zu Forschungsprojekten im Geschäftsbereich des Bayerischen Staatsministeriums für Umwelt und Verbraucherschutz" href="forschung/index.htm"> <img class="bild_doppelpfeil" src="/style/layout/doppelpfeil.gif" alt="" height="8" width="9"> Forschung</a></p>

The code on the right is being flagged as an issue: image

The only difference is the placement of the < br> element. It should be consistently either an error or no error. Visually both options look the same.

Let mw know if you have any questions! :-)

TobiasG95 avatar Nov 27 '23 07:11 TobiasG95

Thanks for the issue. I couldn't reproduce the issue with the page provided. I had to manually edit the HTML of the page to match the screenshots, at which point I was able to reproduce.

For simplicity here's a reproducible test case:

<div style="color: #000">
  <p>
    Hello world <a href="#" id="br-in" style="color: #333; text-decoration: none;"><br/>here we go</a>
  </p>
  <p>
    Hello world <br/><a href="#" id="br-out" style="color: #333; text-decoration: none;">here we go</a>
  </p>
</div>

The first paragraph with the <br/> tag inside the link shows a violation, whereas the second paragraph with the <br/> outside the link passes.

straker avatar Nov 29 '23 16:11 straker

Thanks for the quick feedback! I believe the website owner changed the html to hide the issue.

TobiasG95 avatar Nov 29 '23 17:11 TobiasG95

I just tested this (using a code pen and the code that straker provided in his comment on 11/29/2023)...and I think this issue is fixed. Can someone else double-check me...and if you too see it is fixed...can you close this issue?

goodwitch avatar Jul 05 '24 19:07 goodwitch

Tested. This is still an issue.

WilcoFiers avatar Jul 09 '24 12:07 WilcoFiers