@@ -27,6 +27,10 @@ export default function createGrid(
2727) {
2828 // Prevent multiple calls per run
2929 if ( cache . get ( 'gridCreated' ) && ! parentVNode ) {
30+ // a11y-engine-domforge change
31+ if ( cache . get ( 'gridSize' ) ) {
32+ return cache . get ( 'gridSize' ) ;
33+ }
3034 return constants . gridSize ;
3135 }
3236 cache . set ( 'gridCreated' , true ) ;
@@ -110,6 +114,11 @@ export default function createGrid(
110114
111115 node = treeWalker . nextNode ( ) ;
112116 }
117+
118+ // a11y-engine-domforge change
119+ if ( cache . get ( 'gridSize' ) ) {
120+ return cache . get ( 'gridSize' ) ;
121+ }
113122 return constants . gridSize ;
114123}
115124
@@ -430,6 +439,10 @@ class Grid {
430439 * @returns {number }
431440 */
432441 toGridIndex ( num ) {
442+ // a11y-engine-domforge change
443+ if ( cache . get ( 'gridSize' ) ) {
444+ return Math . floor ( num / cache . get ( 'gridSize' ) ) ;
445+ }
433446 return Math . floor ( num / constants . gridSize ) ;
434447 }
435448
@@ -442,10 +455,18 @@ class Grid {
442455 assert ( this . boundaries , 'Grid does not have cells added' ) ;
443456 const rowIndex = this . toGridIndex ( y ) ;
444457 const colIndex = this . toGridIndex ( x ) ;
445- assert (
446- isPointInRect ( { y : rowIndex , x : colIndex } , this . boundaries ) ,
447- 'Element midpoint exceeds the grid bounds'
448- ) ;
458+
459+ // a11y-engine-domforge change
460+ if ( cache . get ( 'ruleId' ) === 'resize-2x-zoom' ) {
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+ }
449470 const row = this . cells [ rowIndex - this . cells . _negativeIndex ] ?? [ ] ;
450471 return row [ colIndex - row . _negativeIndex ] ?? [ ] ;
451472 }
0 commit comments