Skip to content

Commit

Permalink
Merge pull request #3454 from dequelabs/release-4.4.2
Browse files Browse the repository at this point in the history
chore(release): 4.4.2
  • Loading branch information
WilcoFiers authored May 12, 2022
2 parents f583c70 + bdd71d5 commit c31d85c
Show file tree
Hide file tree
Showing 44 changed files with 1,481 additions and 2,039 deletions.
57 changes: 30 additions & 27 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ unix_nightly_box: &unix_nightly_box

win_box: &win_box
executor:
name: win/vs2019
name: win/default
shell: bash.exe

orbs:
win: circleci/windows@1.0.0
win: circleci/windows@2.2.0
puppeteer: threetreeslight/puppeteer@0.1.2
browser-tools: circleci/browser-tools@1.1.0

Expand All @@ -36,20 +36,6 @@ restore_dependency_cache_win: &restore_dependency_cache_win
- v9-cache-win-{{ checksum "package-lock.json" }}
- v9-cache-win-

# install the version of chromedriver that matches the currently installed version of Chrome (taken from CircleCI chromedriver script)
install_linux_chromedriver: &install_linux_chromedriver
run:
name: Install Chromedriver
command: |
CHROME_VERSION="$(google-chrome --version)"
CHROME_VERSION_STRING="$(echo $CHROME_VERSION | sed 's/^Google Chrome //' | sed 's/^Chromium //')"
echo "Installed version of Google Chrome is $CHROME_VERSION_STRING"
CHROMEDRIVER_RELEASE="${CHROME_VERSION_STRING%%.*}"
echo "ChromeDriver $CHROMEDRIVER_RELEASE will be installed"
npm install --no-save "chromedriver@$CHROMEDRIVER_RELEASE"
jobs:
# Fetch and cache dependencies.
dependencies_unix:
Expand All @@ -60,7 +46,7 @@ jobs:
- <<: *set_npm_auth
- <<: *restore_dependency_cache_unix
- run: npm ci
- <<: *install_linux_chromedriver
- run: npx browser-driver-manager install chromedriver --verbose
- save_cache:
key: v9-cache-unix-{{ checksum "package-lock.json" }}
paths:
Expand Down Expand Up @@ -133,8 +119,6 @@ jobs:
steps:
- checkout
- <<: *restore_dependency_cache_unix
# Always run on the latest master branch, regardless of cache
- run: npm install act-rules/act-rules.github.io#master
- run: npm run build
- run: npm run test:act

Expand Down Expand Up @@ -177,11 +161,8 @@ jobs:
- <<: *restore_dependency_cache_unix
- run: npm run build
- run:
name: Install Chrome Beta
command: |
wget https://dl.google.com/linux/direct/google-chrome-beta_current_amd64.deb
sudo apt install ./google-chrome-beta_current_amd64.deb
- <<: *install_linux_chromedriver
name: Install Chrome and ChromeDriver Beta
command: npx browser-driver-manager install chrome=beta chromedriver=beta --verbose
- run:
name: Install Firefox Nightly
command: |
Expand All @@ -193,16 +174,35 @@ jobs:
- run: npm run test -- --browsers Chrome,FirefoxNightly

# Run the test suite for nightly builds.
test_nightly_aria_practices:
test_nightly_act:
<<: *defaults
<<: *unix_nightly_box
steps:
- browser-tools/install-browser-tools
- checkout
- <<: *restore_dependency_cache_unix
- browser-tools/install-browser-tools
# install ACT rules
# install first as for some reason installing a single package
# also re-installs all repo dependencies as well
- run: npm install act-rules/act-rules.github.io#master
- run: npx browser-driver-manager install chromedriver --verbose
- run: npm run build
- run: npm run test:act

# Run the test suite for nightly builds.
test_nightly_aria_practices:
<<: *defaults
<<: *unix_nightly_box
steps:
- checkout
- <<: *restore_dependency_cache_unix
- browser-tools/install-browser-tools
# install ARIA practices
# install first as for some reason installing a single package
# also re-installs all repo dependencies as well
- run: npm install w3c/aria-practices#main
- run: npx browser-driver-manager install chromedriver --verbose
- run: npm run build
- run: npm run test:apg

# Test api docs can be built
Expand Down Expand Up @@ -263,7 +263,7 @@ jobs:
# Create a GitHub release.
github_release:
docker:
- image: circleci/golang:1.10
- image: cimg/go:1.17.1
steps:
- checkout
- run: go get gopkg.in/aktau/github-release.v0
Expand Down Expand Up @@ -409,6 +409,9 @@ workflows:
- test_nightly_browsers:
requires:
- dependencies_unix
- test_nightly_act:
requires:
- dependencies_unix
- test_nightly_aria_practices:
requires:
- dependencies_unix
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ test/integration/*/index.html
axe.js
axe.*.js

# generated src file
lib/core/base/metadata-function-map.js

# generated jsdoc api docs
doc/api/*
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [4.4.2](https://github.com/dequelabs/axe-core/compare/v4.4.1...v4.4.2) (2022-05-12)

### Bug Fixes

- **aria-hidden-focusable:** report incomplete with onfocus ([#3407](https://github.com/dequelabs/axe-core/issues/3407)) ([6755e89](https://github.com/dequelabs/axe-core/commit/6755e8961389ba2fcf87c7877737482b819a0553))
- **aria-hidden-focus:** Update rule help & description ([#3422](https://github.com/dequelabs/axe-core/issues/3422)) ([7cfb4b1](https://github.com/dequelabs/axe-core/commit/7cfb4b1c468231022838bbbe9edef69fa50de891))
- **aria-valid-attr-value:** add note about element id being in a different shadow DOM tree ([#3421](https://github.com/dequelabs/axe-core/issues/3421)) ([24f74df](https://github.com/dequelabs/axe-core/commit/24f74df8474cfd4f602cb368563955ff42cc2870))
- **color-contrast:** consistently return color contrast information in the data object for pseudo elements ([#3453](https://github.com/dequelabs/axe-core/issues/3453)) ([1a9d95e](https://github.com/dequelabs/axe-core/commit/1a9d95effeaca26e2d7cf7aa867e6a76f8cf50ad))
- **deprecatedrole,color-contrast:** fix message to properly include deprecated role, improve color-contrast pass messages ([#3387](https://github.com/dequelabs/axe-core/issues/3387)) ([650e503](https://github.com/dequelabs/axe-core/commit/650e5037dc1f8908897e834ee1ab3aa8e87ac1e7))
- **html-elms:** update role allowances for nav element ([#3402](https://github.com/dequelabs/axe-core/issues/3402)) ([8aa816a](https://github.com/dequelabs/axe-core/commit/8aa816a15fbd667ee2bf8256a984dcc8aa7c0392)), closes [#3401](https://github.com/dequelabs/axe-core/issues/3401)
- **standards:** fix address typo in html-elms.js ([#3418](https://github.com/dequelabs/axe-core/issues/3418)) ([f235cc7](https://github.com/dequelabs/axe-core/commit/f235cc7069734096df8db434d4c1e68f11fcc88d)), closes [#3417](https://github.com/dequelabs/axe-core/issues/3417)

## [4.4.1](https://github.com/dequelabs/axe-core/compare/v4.4.0...v4.4.1) (2022-02-03)

### Bug Fixes
Expand Down
15 changes: 15 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,20 @@ module.exports = function(grunt) {
]
}
},
'metadata-function-map': {
core: {
files: [
{
expand: true,
src: [
'lib/checks/**/*-{evaluate,after}.js',
'lib/rules/**/*-matches.js'
],
dest: 'lib/core/base/metadata-function-map.js'
}
]
}
},
'aria-supported': {
data: {
entry: 'lib/commons/aria/index.js',
Expand Down Expand Up @@ -239,6 +253,7 @@ module.exports = function(grunt) {
grunt.registerTask('build', [
'clean:core',
'validate',
'metadata-function-map',
'esbuild',
'configure',
'babel',
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "axe-core",
"version": "4.4.1",
"version": "4.4.2",
"contributors": [
{
"name": "David Sturley",
Expand Down
49 changes: 49 additions & 0 deletions build/tasks/metadata-function-map.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
const path = require('path').posix;
const glob = require('glob');
const fs = require('fs');

function toTitleCase(str) {
return str.replace(/-\w/g, txt => {
return txt.charAt(1).toUpperCase() + txt.substr(2).toLowerCase();
});
}

module.exports = function(grunt) {
grunt.registerMultiTask(
'metadata-function-map',
'Task to generate the metadata-function-map file',
function() {
const files = grunt.task.current.data.files;

files.forEach(file => {
const src = Array.isArray(file.src) ? file.src : [file.src];
const map = {};
let outFile =
'// This file is automatically generated using build/tasks/metadata-function-map.js\n';

src.forEach(globPath => {
glob.sync(globPath).forEach(filePath => {
const relativePath = path.relative(
path.dirname(file.dest),
filePath
);
const filename = path.basename(filePath, '.js');
const functionName = toTitleCase(filename);

outFile += `import ${functionName} from '${relativePath}';\n`;
map[filename] = functionName;
});
});

outFile += `\nconst metadataFunctionMap = {\n`;
outFile += Object.keys(map)
.sort()
.map(key => ` '${key}': ${map[key]}`)
.join(',\n');
outFile += `\n};\n\nexport default metadataFunctionMap;`;

fs.writeFileSync(file.dest, outFile, 'utf-8');
});
}
);
};
2 changes: 2 additions & 0 deletions doc/issue_impact.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Axe-core assigns an impact according to our assessment of the likely impact of an issue on a user with a disability that would be affected by this issue. In any given context the actual impact for the user could be lower; in some instances, it could be higher. For this reason, we encourage users of tools to evaluate each individual issue and assess the impact in the context of their application or content.

For a list of each rule and their associated impacts, see [rule-descriptions.md](./rule-descriptions.md)

## Definitions

### Minor
Expand Down
1 change: 1 addition & 0 deletions doc/projects.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,4 @@ Add your project/integration to this file and submit a pull request.
1. [Selenium.Axe for .NET](https://github.com/TroyWalshProf/SeleniumAxeDotnet)
1. [vue-axe](https://github.com/vue-a11y/vue-axe-next)
1. [a11y-sitechecker](https://github.com/forsti0506/a11y-sitechecker)
1. [Parcel](https://parcel.io)
2 changes: 1 addition & 1 deletion doc/rule-descriptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
| [aria-allowed-attr](https://dequeuniversity.com/rules/axe/4.4/aria-allowed-attr?application=RuleDescription) | Ensures ARIA attributes are allowed for an element&apos;s role | Serious, Critical | cat.aria, wcag2a, wcag412 | failure, needs&nbsp;review | [5c01ea](https://act-rules.github.io/rules/5c01ea) |
| [aria-command-name](https://dequeuniversity.com/rules/axe/4.4/aria-command-name?application=RuleDescription) | Ensures every ARIA button, link and menuitem has an accessible name | Serious | cat.aria, wcag2a, wcag412 | failure, needs&nbsp;review | [97a4e1](https://act-rules.github.io/rules/97a4e1) |
| [aria-hidden-body](https://dequeuniversity.com/rules/axe/4.4/aria-hidden-body?application=RuleDescription) | Ensures aria-hidden=&apos;true&apos; is not present on the document body. | Critical | cat.aria, wcag2a, wcag412 | failure | |
| [aria-hidden-focus](https://dequeuniversity.com/rules/axe/4.4/aria-hidden-focus?application=RuleDescription) | Ensures aria-hidden elements do not contain focusable elements | Serious | cat.name-role-value, wcag2a, wcag412, wcag131 | failure, needs&nbsp;review | [6cfa84](https://act-rules.github.io/rules/6cfa84) |
| [aria-hidden-focus](https://dequeuniversity.com/rules/axe/4.4/aria-hidden-focus?application=RuleDescription) | Ensures aria-hidden elements are not focusable nor contain focusable elements | Serious | cat.name-role-value, wcag2a, wcag412, wcag131 | failure, needs&nbsp;review | [6cfa84](https://act-rules.github.io/rules/6cfa84) |
| [aria-input-field-name](https://dequeuniversity.com/rules/axe/4.4/aria-input-field-name?application=RuleDescription) | Ensures every ARIA input field has an accessible name | Moderate, Serious | cat.aria, wcag2a, wcag412, ACT | failure, needs&nbsp;review | [e086e5](https://act-rules.github.io/rules/e086e5) |
| [aria-meter-name](https://dequeuniversity.com/rules/axe/4.4/aria-meter-name?application=RuleDescription) | Ensures every ARIA meter node has an accessible name | Serious | cat.aria, wcag2a, wcag111 | failure, needs&nbsp;review | |
| [aria-progressbar-name](https://dequeuniversity.com/rules/axe/4.4/aria-progressbar-name?application=RuleDescription) | Ensures every ARIA progressbar node has an accessible name | Serious | cat.aria, wcag2a, wcag111 | failure, needs&nbsp;review | |
Expand Down
8 changes: 6 additions & 2 deletions lib/checks/aria/aria-valid-attr-value-evaluate.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ function ariaValidAttrValueEvaluate(node, options, virtualNode) {
needsReview = `aria-describedby="${virtualNode.attr(
'aria-describedby'
)}"`;
messageKey = 'noId';
// TODO: es-modules_tree
messageKey =
axe._tree && axe._tree[0]._hasShadowRoot ? 'noIdShadow' : 'noId';
}

return;
Expand All @@ -80,7 +82,9 @@ function ariaValidAttrValueEvaluate(node, options, virtualNode) {
needsReview = `aria-labelledby="${virtualNode.attr(
'aria-labelledby'
)}"`;
messageKey = 'noId';
// TODO: es-modules_tree
messageKey =
axe._tree && axe._tree[0]._hasShadowRoot ? 'noIdShadow' : 'noId';
}
}
};
Expand Down
1 change: 1 addition & 0 deletions lib/checks/aria/aria-valid-attr-value.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
},
"incomplete": {
"noId": "ARIA attribute element ID does not exist on the page: ${data.needsReview}",
"noIdShadow": "ARIA attribute element ID does not exist on the page or is a descendant of a different shadow DOM tree: ${data.needsReview}",
"ariaCurrent": "ARIA attribute value is invalid and will be treated as \"aria-current=true\": ${data.needsReview}",
"idrefs": "Unable to determine if ARIA attribute element ID exists on the page: ${data.needsReview}"
}
Expand Down
2 changes: 1 addition & 1 deletion lib/checks/aria/deprecatedrole.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"impact": "minor",
"messages": {
"pass": "ARIA role is not deprecated",
"fail": "The role used is deprecated: ${data.values}"
"fail": "The role used is deprecated: ${data}"
}
}
}
35 changes: 22 additions & 13 deletions lib/checks/color/color-contrast-evaluate.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export default function colorContrastEvaluate(node, options, virtualNode) {
} = options;

if (!isVisible(node, false)) {
this.data({ messageKey: 'hidden' });
return true;
}

Expand All @@ -39,14 +40,33 @@ export default function colorContrastEvaluate(node, options, virtualNode) {
return undefined;
}

const nodeStyle = window.getComputedStyle(node);
const fontSize = parseFloat(nodeStyle.getPropertyValue('font-size'));
const fontWeight = nodeStyle.getPropertyValue('font-weight');
const bold = parseFloat(fontWeight) >= boldValue || fontWeight === 'bold';

const ptSize = Math.ceil(fontSize * 72) / 96;
const isSmallFont =
(bold && ptSize < boldTextPt) || (!bold && ptSize < largeTextPt);

const { expected, minThreshold, maxThreshold } = isSmallFont
? contrastRatio.normal
: contrastRatio.large;

// if element or a parent has pseudo content then we need to mark
// as needs review
const pseudoElm = findPseudoElement(virtualNode, {
ignorePseudo,
pseudoSizeThreshold
});
if (pseudoElm) {
this.data({ messageKey: 'pseudoContent' });
this.data({
fontSize: `${((fontSize * 72) / 96).toFixed(1)}pt (${fontSize}px)`,
fontWeight: bold ? 'bold' : 'normal',
messageKey: 'pseudoContent',
expectedContrastRatio: expected + ':1'
});

this.relatedNodes(pseudoElm.actualNode);
return undefined;
}
Expand All @@ -60,11 +80,6 @@ export default function colorContrastEvaluate(node, options, virtualNode) {
maxRatio: shadowOutlineEmMax
});

const nodeStyle = window.getComputedStyle(node);
const fontSize = parseFloat(nodeStyle.getPropertyValue('font-size'));
const fontWeight = nodeStyle.getPropertyValue('font-weight');
const bold = parseFloat(fontWeight) >= boldValue || fontWeight === 'bold';

let contrast = null;
let contrastContributor = null;
let shadowColor = null;
Expand All @@ -83,20 +98,14 @@ export default function colorContrastEvaluate(node, options, virtualNode) {
}
}

const ptSize = Math.ceil(fontSize * 72) / 96;
const isSmallFont =
(bold && ptSize < boldTextPt) || (!bold && ptSize < largeTextPt);

const { expected, minThreshold, maxThreshold } = isSmallFont
? contrastRatio.normal
: contrastRatio.large;
const isValid = contrast > expected;

// ratio is outside range
if (
(typeof minThreshold === 'number' && contrast < minThreshold) ||
(typeof maxThreshold === 'number' && contrast > maxThreshold)
) {
this.data({ contrastRatio: contrast });
return true;
}

Expand Down
5 changes: 4 additions & 1 deletion lib/checks/color/color-contrast.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
"metadata": {
"impact": "serious",
"messages": {
"pass": "Element has sufficient color contrast of ${data.contrastRatio}",
"pass": {
"default": "Element has sufficient color contrast of ${data.contrastRatio}",
"hidden": "Element is hidden"
},
"fail": {
"default": "Element has insufficient color contrast of ${data.contrastRatio} (foreground color: ${data.fgColor}, background color: ${data.bgColor}, font size: ${data.fontSize}, font weight: ${data.fontWeight}). Expected contrast ratio of ${data.expectedContrastRatio}",
"fgOnShadowColor": "Element has insufficient color contrast of ${data.contrastRatio} between the foreground and shadow color (foreground color: ${data.fgColor}, text-shadow color: ${data.shadowColor}, font size: ${data.fontSize}, font weight: ${data.fontWeight}). Expected contrast ratio of ${data.expectedContrastRatio}",
Expand Down
Loading

0 comments on commit c31d85c

Please sign in to comment.