You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As part of #4117 we determined that the math.getOffset calculation is not correct and needs to be updated. It didn't produce any false-positives so we decided to update the code in another pr in order to get 4.8 out the door.
The algorithm should be as follows:
For targets with target size >= 24x24px, we should make sure we skip the (potentially expensive) offset calculation since the spacing exception isn't relevant. Target size === largest unobscured rect from math.splitRects. E.g. the result of calling dom.getTargetSize.
Otherwise, for undersized targets:
determine bounding rect of target and get the center (we'll call centerTarget). Bounding rect === the result of calling math.getBoundingRect for each rect in splitRects. (should be a new function)
determine the target's "neighbors" using grid (any other target that might be within 24px of any part of target's bounding rect is a neighbor)
for each neighbor:
determine neighborSplitRects using math.splitRects(neighbor)
for each neighborSplitRect:
calculate distance from centerTarget to the nearest point in neighborSplitRect (may be 0 if centerTarget lies within neighborSplitRect)
let neighborSpacing be the minimum neighborSplitRect distance
if the neighbor is also undersized (target size < 24x24px):
calculate centerNeighbor similarly to centerTarget using the neighbor's bounding box
if the distance from centerTarget to centerNeighbor is < neighborSpacing, use that as the new neighborSpacing
return the minimum neighborSpacing from among all neighbors
The text was updated successfully, but these errors were encountered:
Validated with the latest axe-core develop branch code base,
on running await axe.run({runOnly:'target-size'}); at the console for latest axe.js script
failureSummary:
"Fix any of the following:\n Target has insufficient size (10px by 10px, should be at least 24px by 24px)\n Target has insufficient space to its closest neighbors. Safe clickable space has a diameter of 0px instead of at least 24px."
Environment:
Label
Value
Product
axe-core
Version
4.8.2
OS-Details
_MAC- Intel Core i7 - 11.6.8 _
BrowserDetails
Chrome Version 117.0.5938.88 (Official Build) (64-bit)
As part of #4117 we determined that the
math.getOffset
calculation is not correct and needs to be updated. It didn't produce any false-positives so we decided to update the code in another pr in order to get 4.8 out the door.The algorithm should be as follows:
For targets with target size >= 24x24px, we should make sure we skip the (potentially expensive) offset calculation since the spacing exception isn't relevant. Target size === largest unobscured rect from
math.splitRects
. E.g. the result of callingdom.getTargetSize
.Otherwise, for undersized
target
s:target
and get the center (we'll callcenterTarget
). Bounding rect === the result of callingmath.getBoundingRect
for each rect insplitRects
. (should be a new function)target
's bounding rect is a neighbor)neighbor
:neighborSplitRects
usingmath.splitRects(neighbor)
neighborSplitRect
:centerTarget
to the nearest point inneighborSplitRect
(may be 0 ifcenterTarget
lies withinneighborSplitRect
)neighborSpacing
be the minimumneighborSplitRect
distanceneighbor
is also undersized (target size < 24x24px):centerNeighbor
similarly tocenterTarget
using the neighbor's bounding boxcenterTarget
tocenterNeighbor
is <neighborSpacing
, use that as the newneighborSpacing
neighborSpacing
from among all neighborsThe text was updated successfully, but these errors were encountered: