Skip to content

Commit

Permalink
Merge pull request #124 from browserstack/release-3.5.0
Browse files Browse the repository at this point in the history
fix: Release 3.5.0 changes
  • Loading branch information
ansh21 authored Jan 23, 2025
2 parents a1eed77 + bc96242 commit 4b49026
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 13 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ module.exports = {
},
globals: {
axe: true,
Promise: true
Promise: true,
a11yEngine: true
},
rules: {
'no-bitwise': 2,
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ jobs:
cache: 'npm'
- run: npm ci
- run: npm run build
# v4 download seems to have some flakiness with the download of artifacts so pinning to v3 for now
# @see https://github.com/actions/download-artifact/issues/249
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: axe-core
path: axe.js
Expand Down
3 changes: 1 addition & 2 deletions lib/checks/color/link-in-text-block-evaluate.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
getBackgroundColor,
incompleteData
} from '../../commons/color';
import a11yEngineCommons from '../../commons/a11y-engine-index';

function getContrast(color1, color2) {
var c1lum = color1.getRelativeLuminance();
Expand Down Expand Up @@ -53,7 +52,7 @@ function linkInTextBlockEvaluate(node, options) {
) {
return true;
}
return a11yEngineCommons.distinguishableLinkEvaluate(node, parentBlock);
return a11yEngine.commons.distinguishableLinkEvaluate(node, parentBlock);
}

// Capture colors
Expand Down
6 changes: 0 additions & 6 deletions lib/commons/a11y-engine-index.js

This file was deleted.

38 changes: 37 additions & 1 deletion lib/rules/autocomplete-a11y-matches.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,50 @@ function nodeIsASearchFunctionality(actualNode, currLevel = 0, maxLevels = 4) {
return currentLevelSearch(actualNode, currLevel);
}

function quantityField(node) {
const keywords = [
'qty',
'quantity',
'quantities',
'km',
'kilometer',
'drive',
'code',
'mileage',
'power',
'fuel'
];
const attributes = [
'name',
'id',
'title',
'placeholder',
'aria-label',
'data-label',
'data-title',
'data-placeholder',
'role'
];
return attributes.some(attr => {
if (node.hasAttribute(attr)) {
const value = node.getAttribute(attr).toLowerCase();
return keywords.some(
keyword => value && value.includes(keyword.toLowerCase())
);
}
return false;
});
}

function autocompleteA11yMatches(node, virtualNode) {
const a11yEngineFlag = true;
/* the flag is used to tell autocomplete matcher that it is being called
by a11y-engine and thus bypass an if block
The second condition is to check we are not matching with search functionality */
return (
autocompleteMatches(node, virtualNode, a11yEngineFlag) &&
!nodeIsASearchFunctionality(node)
!nodeIsASearchFunctionality(node) &&
!quantityField(node)
);
}

Expand Down

0 comments on commit 4b49026

Please sign in to comment.