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

link-in-text-block does not consider an inline-block as a text block

Open dballesteros7 opened this issue 2 years ago • 2 comments

Product

axe-core

Product Version

4.5.2

Latest Version

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

Issue Description

Expectation

I would expect the check to fail with this HTML:

<p>
 Text
 <a style="display: inline-block;">link</a>
</p>

This fails if the inline-block is removed, and visually they are both identical.

Actual

Passes

How to Reproduce

https://codepen.io/dballesteros7/pen/mdjreWM

Additional context

This allows to easily/unintentionally skip the check for inline blocks of text.

dballesteros7 avatar Jan 03 '23 18:01 dballesteros7

@dballesteros7 You are correct. When axe encounters display: inline-block it bails. This happens to avoid potential false positives. Because of how much more styles could be applied to inline-block, it's impossible for us to programmatically determine that that link is still actually part of the text.

I wouldn't want to fail such links, but perhaps we could report them for review, instead of them getting completely ignored. Did you encounter this in a real-world scenario where you had inline links with display: inline-block on them? I'd be interested to see an example of that. Perhaps we can figure out how to improve the rule to be able to catch such a scenario. I just can't really think of a reason of why a normal text block would have that kind of styling.

WilcoFiers avatar Jan 06 '23 14:01 WilcoFiers

Did you encounter this in a real-world scenario where you had inline links with display: inline-block on them? I'd be interested to see an example of that.

I think the most likely example is going to be cases where folks use <button role="link"> for whatever reason.

dbjorge avatar Apr 01 '24 19:04 dbjorge