@@ -27,6 +27,7 @@ export default function createGrid(
27
27
) {
28
28
// Prevent multiple calls per run
29
29
if ( cache . get ( 'gridCreated' ) && ! parentVNode ) {
30
+ // a11y-engine-domforge change
30
31
if ( cache . get ( 'gridSize' ) ) {
31
32
return cache . get ( 'gridSize' ) ;
32
33
}
@@ -114,6 +115,7 @@ export default function createGrid(
114
115
node = treeWalker . nextNode ( ) ;
115
116
}
116
117
118
+ // a11y-engine-domforge change
117
119
if ( cache . get ( 'gridSize' ) ) {
118
120
return cache . get ( 'gridSize' ) ;
119
121
}
@@ -437,6 +439,7 @@ class Grid {
437
439
* @returns {number }
438
440
*/
439
441
toGridIndex ( num ) {
442
+ // a11y-engine-domforge change
440
443
if ( cache . get ( 'gridSize' ) ) {
441
444
return Math . floor ( num / cache . get ( 'gridSize' ) ) ;
442
445
}
@@ -452,10 +455,18 @@ class Grid {
452
455
assert ( this . boundaries , 'Grid does not have cells added' ) ;
453
456
const rowIndex = this . toGridIndex ( y ) ;
454
457
const colIndex = this . toGridIndex ( x ) ;
455
- assert (
456
- isPointInRect ( { y : rowIndex , x : colIndex } , this . boundaries ) ,
457
- 'Element midpoint exceeds the grid bounds'
458
- ) ;
458
+
459
+ // a11y-engine-domforge change
460
+ if ( cache . get ( 'ruleId' ) === 'zoom-text-overlap-viewport' ) {
461
+ if ( ! isPointInRect ( { y : rowIndex , x : colIndex } , this . boundaries ) ) {
462
+ return [ ] ;
463
+ }
464
+ } else {
465
+ assert (
466
+ isPointInRect ( { y : rowIndex , x : colIndex } , this . boundaries ) ,
467
+ 'Element midpoint exceeds the grid bounds'
468
+ ) ;
469
+ }
459
470
const row = this . cells [ rowIndex - this . cells . _negativeIndex ] ?? [ ] ;
460
471
return row [ colIndex - row . _negativeIndex ] ?? [ ] ;
461
472
}
0 commit comments