diff --git a/lib/checks/mobile/target-offset-evaluate.js b/lib/checks/mobile/target-offset-evaluate.js index de361b1131..af7767fff1 100644 --- a/lib/checks/mobile/target-offset-evaluate.js +++ b/lib/checks/mobile/target-offset-evaluate.js @@ -12,11 +12,6 @@ export default function targetOffsetEvaluate(node, options, vNode) { if (getRoleType(vNeighbor) !== 'widget' || !isFocusable(vNeighbor)) { continue; } - // the offset code works off radius but we want our messaging to reflect diameter - - // getOffeset can return null now - // pass early if size is 10x (just like target-size) - // handle null as well const offset = roundToSingleDecimal(getOffset(vNode, vNeighbor, minOffset / 2)) * 2; diff --git a/locales/_template.json b/locales/_template.json index 1ce6e1c658..3a3e498f55 100644 --- a/locales/_template.json +++ b/locales/_template.json @@ -885,7 +885,8 @@ "default": "Element with negative tabindex has insufficient size (${data.width}px by ${data.height}px, should be at least ${data.minSize}px by ${data.minSize}px). Is this a target?", "contentOverflow": "Element size could not be accurately determined due to overflow content", "partiallyObscured": "Element with negative tabindex has insufficient size because it is partially obscured (smallest space is ${data.width}px by ${data.height}px, should be at least ${data.minSize}px by ${data.minSize}px). Is this a target?", - "partiallyObscuredNonTabbable": "Target has insufficient size because it is partially obscured by a neighbor with negative tabindex (smallest space is ${data.width}px by ${data.height}px, should be at least ${data.minSize}px by ${data.minSize}px). Is the neighbor a target?" + "partiallyObscuredNonTabbable": "Target has insufficient size because it is partially obscured by a neighbor with negative tabindex (smallest space is ${data.width}px by ${data.height}px, should be at least ${data.minSize}px by ${data.minSize}px). Is the neighbor a target?", + "tooManyRects": "Could not calculate calculate largest obscured rectangle as there are too many overlapping widgets" } }, "header-present": { diff --git a/test/checks/mobile/target-offset.js b/test/checks/mobile/target-offset.js index f160baa10f..47ff219834 100644 --- a/test/checks/mobile/target-offset.js +++ b/test/checks/mobile/target-offset.js @@ -120,6 +120,36 @@ describe('target-offset tests', () => { assert.deepEqual(relatedIds, ['#left', '#right']); }); + it('returns false if there are too many focusable widgets', () => { + let html = ''; + for (let i = 0; i < 100; i++) { + html += ` + + Hello + Hello + Hello + Hello + Hello + Hello + Hello + + + + + `; + } + const checkArgs = checkSetup(` +
+ ${html}
+
+ `); + assert.isFalse(checkEvaluate.apply(checkContext, checkArgs)); + assert.deepEqual(checkContext._data, { + closestOffset: 0, + minOffset: 24 + }); + }); + describe('when neighbors are focusable but not tabbable', () => { it('returns undefined if all neighbors are not tabbable', () => { const checkArgs = checkSetup(