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

Release 3.0.0 #98

Merged
merged 24 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
8ca2d2d
added changes for build process
SwarajGK Sep 11, 2024
01d91e9
:robot: Automated formatting fixes
SwarajGK Sep 11, 2024
80bf267
Updated axe-core files for 200% zoom
Sep 11, 2024
aceb5cd
Adressed issue
Sep 18, 2024
ace6841
Adressed issue
Sep 18, 2024
9fa53cb
Merge branch 'main' of github.com:browserstack/a11y-engine-axe-core i…
Sep 18, 2024
19077ec
Adressed issue
Sep 19, 2024
7bc9186
Adressed issue
Sep 19, 2024
05e2ce4
Merge branch 'main' of github.com:browserstack/a11y-engine-axe-core i…
SwarajGK Sep 19, 2024
f1c08a4
Merge branch 'dom-forge-build-changes' of github.com:browserstack/a11…
SwarajGK Sep 19, 2024
49c223f
Reverted to cache method
Sep 19, 2024
6950c10
Reverted to cache method
Sep 19, 2024
6a26aa6
Added fix in getCellFromPoint in create-grid.js for 200% zoom
Sep 20, 2024
0b61ea2
Merge branch 'dom-forge-build-changes' of github.com:browserstack/a11…
SwarajGK Sep 25, 2024
5cd4a1f
Updated rule name
Oct 3, 2024
6b98646
Added safety to a11yEngineErrors
chikara1608 Oct 7, 2024
77cf978
Merge remote-tracking branch 'origin/release-3.0.0' into AXE-570_a11y…
chikara1608 Oct 8, 2024
f6d19ff
Merge branch 'main' of github.com:browserstack/a11y-engine-axe-core i…
Oct 8, 2024
a59be20
Merge branch 'release-3.0.0' into AXE-570_a11yEngineErrors
chikara1608 Oct 8, 2024
1f811bf
Merge pull request #103 from browserstack/AXE-570_a11yEngineErrors
ansh21 Oct 9, 2024
5610917
Revert "Fix: AXE-570 Fixed a11yEngineErrors being accessed on undefined"
ansh21 Oct 9, 2024
a8b0958
Merge pull request #104 from browserstack/revert-103-AXE-570_a11yEngi…
ansh21 Oct 9, 2024
3251c8c
Revert "Revert "Fix: AXE-570 Fixed a11yEngineErrors being accessed on…
ansh21 Oct 9, 2024
822d241
Merge pull request #105 from browserstack/revert-104-revert-103-AXE-5…
chikara1608 Oct 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions lib/commons/dom/create-grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ export default function createGrid(
) {
// Prevent multiple calls per run
if (cache.get('gridCreated') && !parentVNode) {
if (cache.get('gridSize')) {
return cache.get('gridSize');
}
Abhi3685 marked this conversation as resolved.
Show resolved Hide resolved
return constants.gridSize;
}
cache.set('gridCreated', true);
Expand Down Expand Up @@ -110,6 +113,10 @@ export default function createGrid(

node = treeWalker.nextNode();
}

if (cache.get('gridSize')) {
return cache.get('gridSize');
}
return constants.gridSize;
}

Expand Down Expand Up @@ -430,6 +437,9 @@ class Grid {
* @returns {number}
*/
toGridIndex(num) {
if (cache.get('gridSize')) {
return Math.floor(num / cache.get('gridSize'));
}
return Math.floor(num / constants.gridSize);
}

Expand Down
11 changes: 9 additions & 2 deletions lib/commons/dom/get-element-stack.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import createGrid from './create-grid';
* @param {Node} node
* @return {Node[]}
*/
function getElementStack(node) {
function getElementStack(node, isCoordsPassed = false, x, y) {
Abhi3685 marked this conversation as resolved.
Show resolved Hide resolved
createGrid();

const vNode = getNodeFromTree(node);
Expand All @@ -19,7 +19,14 @@ function getElementStack(node) {
return [];
}

return getRectStack(grid, vNode.boundingClientRect);
return getRectStack(
grid,
vNode.boundingClientRect,
false,
isCoordsPassed,
x,
y
);
}

export default getElementStack;
15 changes: 13 additions & 2 deletions lib/commons/dom/get-overflow-hidden-ancestors.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import cache from '../../core/base/cache';
import memoize from '../../core/utils/memoize';

/**
Expand All @@ -17,8 +18,18 @@ const getOverflowHiddenAncestors = memoize(

const overflow = vNode.getComputedStylePropertyValue('overflow');

if (overflow === 'hidden') {
ancestors.push(vNode);
if (cache.get('200%ZoomRule')) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cache.set is present in another PR?

if (
overflow.includes('hidden') ||
overflow.includes('clip') ||
overflow.includes('scroll')
) {
ancestors.push(vNode);
}
} else {
if (overflow.includes('hidden')) {
ancestors.push(vNode);
}
}

return ancestors.concat(getOverflowHiddenAncestors(vNode.parent));
Expand Down
19 changes: 16 additions & 3 deletions lib/commons/dom/get-rect-stack.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
import visuallySort from './visually-sort';
import { getRectCenter } from '../math';

export function getRectStack(grid, rect, recursed = false) {
export function getRectStack(
grid,
rect,
recursed = false,
Abhi3685 marked this conversation as resolved.
Show resolved Hide resolved
isCoordsPassed,
x,
y
) {
const center = getRectCenter(rect);
const gridCell = grid.getCellFromPoint(center) || [];

const floorX = Math.floor(center.x);
const floorY = Math.floor(center.y);
let floorX = Math.floor(center.x);
let floorY = Math.floor(center.y);

if (isCoordsPassed) {
floorX = Math.floor(x);
floorY = Math.floor(y);
}

let stack = gridCell.filter(gridCellNode => {
return gridCellNode.clientRects.some(clientRect => {
const rectX = clientRect.left;
Expand Down
12 changes: 10 additions & 2 deletions lib/commons/dom/get-visible-child-text-rects.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { getNodeFromTree, memoize } from '../../core/utils';
import { sanitize } from '../text';
import { getRectCenter, isPointInRect, getIntersectionRect } from '../math';
import { getIntersectionRect, getRectCenter, isPointInRect } from '../math';
import getOverflowHiddenAncestors from './get-overflow-hidden-ancestors';
import cache from '../../core/base/cache';

/**
* Get the visible text client rects of a node.
Expand All @@ -23,13 +24,19 @@ const getVisibleChildTextRects = memoize(
}

const contentRects = getContentRects(textNode);
if (isOutsideNodeBounds(contentRects, nodeRect)) {
if (
isOutsideNodeBounds(contentRects, nodeRect) &&
!cache.get('200%ZoomRule')
) {
return;
}

clientRects.push(...filterHiddenRects(contentRects, overflowHiddenNodes));
});

if (clientRects.length <= 0 && cache.get('200%ZoomRule')) {
return [];
}
/**
* if all text rects are larger than the bounds of the node,
* or goes outside of the bounds of the node, we need to use
Expand All @@ -44,6 +51,7 @@ const getVisibleChildTextRects = memoize(
*
* @see https://github.com/dequelabs/axe-core/issues/4253
*/

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] Unwanted empty space

return clientRects.length
? clientRects
: filterHiddenRects([nodeRect], overflowHiddenNodes);
Expand Down
Loading