Product
axe-core
Product Version
4.6.3
Latest Version
Issue Description
Expectation
Expected axe-core to be able to handle any valid HTML (the HTML in this case is 100% valid according to the W3C validator)
Actual
The isIconLigature function fails to consider invisible characters at the start of the input, resulting in a SupportError being thrown.
How to Reproduce
Project which reproduces the issue:
axe-core-invisible-issue.zip
Steps:
- Run
npm install
- Start a server to serve the html file (I used the
html-server npm package, for example) or simply open the html file in a browser
- Optionally put some breakpoints (in
node_modules/axe-core/axe.js) to observe the exact source of the issue, on the following lines:
- 11378
var compareData = new Uint32Array(canvasContext.getImageData(0, 0, width, fontSize).data.buffer);
- 11379
if (!compareData.some(function(pixel) {
- 22005
reject(new SupportError({
After hitting the break point right before isIconLigature calls canvasContext.getImageData, you'll be able to see that width and fontSize have been determined to be NaN and Infinity which are invalid parameters for this function, causing it to throw an exception and result in the SupportError being generated. This happens because the first character in the link content of my HTML in this case is [U+2069] which is an invisible character relating to the left-to-right or right-to-left nature of the text (we ran into this issue when checking one of our Arabic-translated files).
Would it be possible to change isIconLigature to look for the first visible character? I suppose there would also need to be a case to handle if there isn't any visible characters in the span as well...
Product
axe-core
Product Version
4.6.3
Latest Version
Issue Description
Expectation
Expected
axe-coreto be able to handle any valid HTML (the HTML in this case is 100% valid according to the W3C validator)Actual
The
isIconLigaturefunction fails to consider invisible characters at the start of the input, resulting in aSupportErrorbeing thrown.How to Reproduce
Project which reproduces the issue:
axe-core-invisible-issue.zip
Steps:
npm installhtml-servernpm package, for example) or simply open the html file in a browsernode_modules/axe-core/axe.js) to observe the exact source of the issue, on the following lines:var compareData = new Uint32Array(canvasContext.getImageData(0, 0, width, fontSize).data.buffer);if (!compareData.some(function(pixel) {reject(new SupportError({After hitting the break point right before
isIconLigaturecallscanvasContext.getImageData, you'll be able to see thatwidthandfontSizehave been determined to beNaNandInfinitywhich are invalid parameters for this function, causing it to throw an exception and result in theSupportErrorbeing generated. This happens because the first character in the link content of my HTML in this case is [U+2069] which is an invisible character relating to the left-to-right or right-to-left nature of the text (we ran into this issue when checking one of our Arabic-translated files).Would it be possible to change
isIconLigatureto look for the first visible character? I suppose there would also need to be a case to handle if there isn't any visible characters in the span as well...