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

target-size should account for the size of its descendants #3673

Closed
WilcoFiers opened this issue Sep 24, 2022 · 2 comments
Closed

target-size should account for the size of its descendants #3673

WilcoFiers opened this issue Sep 24, 2022 · 2 comments
Assignees
Labels
fix Bug fixes pr A pr has been created for the issue target-size
Milestone

Comments

@WilcoFiers
Copy link
Contributor

The new target-size rule looks at the area of the focusable element to determine its size and position relative to other elements. This is making the incorrect assumption that the clickable area of an element cannot exceed its bounding box. This is correct. Any descendant of a link is also clickable, and will activate that parent link. There are numerous ways in which descendants can be positioned outside the boundary of its parent, and so result in a much larger target area than the original link has. One such example is the axe-con logo in the side navigation:

https://www.deque.com/axe-con/sessions/changing-the-way-you-think-and-work-agile-accessibility-audits-in-the-product-life-cycle/

Screenshot axe-con logo who's parent link is much smaller than the actual image it wraps

Solving this could be pretty complicated. I can think of a few scenarios here:

  • If there is no overlap, we could test the widget and the descendants separately, and make sure at least one of them passes
  • If the descendant completely encloses the widget, we could test the descendant instead of the widget
  • I don't know what to do in case of partial overlap like in axe-con's logo, where the link is wide but small, and the image is less wide, but tall.
@dylanb
Copy link
Contributor

dylanb commented Sep 26, 2022

How about if they overlap, test them each independently first, if they do NOT pass (i.e. none is, on its own, the required size), then take the largest common rectangle or largest rectangle in a closed contour and test that. I assume that this satisfies the intent of the S.C.

@WilcoFiers WilcoFiers added this to the Axe-core 4.5 milestone Sep 27, 2022
@WilcoFiers WilcoFiers self-assigned this Oct 8, 2022
@WilcoFiers WilcoFiers added the pr A pr has been created for the issue label Oct 17, 2022
@padmavemulapati
Copy link

Validated with the latest code base,
for the test script, seeing incomplete results when targets have overflowing content.

<a href="#" id="target"><img width="24" height="24"></a>
  <a href="#" id="target" style="font-size:24px;"><img width="24" height="24"></a>

  <a href="#" id="target" style="font-size:24px;">
     <img width="24" height="36" style="vertical-align: bottom;">
    </a><br>
    <a href="" style="margin-top:-10px; position:absolute; width:24px;">&nbsp;</a>

    <a href="#" id="target" style="font-size:24px;">
     <img width="24" height="36" style="vertical-align: bottom;">
      </a><br>
      <a href="" style="margin-top:-2px; position:absolute; width:24px;">&nbsp;</a>

      <a href="#" id="target" style="font-size:24px;">
        <img width="24" height="36" style="vertical-align: bottom;">
        </a><br>
        <a href="" style="margin-top:-40px; position:absolute; width:100px; height:100px;">&nbsp;</a>

        <p>
          <!-- These links touch, images overflow on the left and right -->
          <a href="#" id="incomplete5"
            >&nbsp;
            <img
              src="https://www.w3.org/StyleSheets/TR/2016/logos/W3C"
              width="50"
              height="33"
              alt="M1"
              style="float: left"
            />
          </a>
          <a href="#" id="incomplete6"
            >&nbsp;
            <img
              src="https://www.w3.org/StyleSheets/TR/2016/logos/W3C"
              width="50"
              height="33"
              alt="M4"
              style="position: absolute"
            />
          </a>
        </p>
        
        <p>
          <!-- These links touch, images overflow on the top and bottom -->
          <a href="#" id="incomplete7">
            <img
              src="https://www.w3.org/StyleSheets/TR/2016/logos/W3C"
              width="50"
              height="33"
              alt="M3"
            />
          </a>
          <br />
          <a href="#" id="incomplete8" style="display: inline-block; height: 18px">
            <img
              src="https://www.w3.org/StyleSheets/TR/2016/logos/W3C"
              width="50"
              height="33"
              alt="M2"
            />
          </a>
        </p>

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Bug fixes pr A pr has been created for the issue target-size
Projects
None yet
Development

No branches or pull requests

3 participants