Axe-core: meta-viewport: Cannot read property 'toLowerCase' of undefined

Created on 5 Jun 2020  路  7Comments  路  Source: dequelabs/axe-core

We've been getting a bunch of users hitting the same snag recently: https://github.com/GoogleChrome/lighthouse/issues/10908

It now looks like it's all due to the meta-viewport rule. It's marked as incomplete and has an .error.message of Cannot read property 'toLowerCase' of undefined.

We're using axe 3.5.3 and briefly looking at the changelog I have a suspicion our culprit is #2137 ("fix(meta-viewport): parse negative and string values for maximum-scale").. which does include a few calls to toLowerCase().

@widmanski's comment has a conjecture that looks compelling to me:

Update I'm pretty sure the error resulted from axe-core failing to parse our viewport tag due to legacy / invalid content (we copied it over from the previous version of the website) - <meta name="viewport" content="width=device-width,initial-scale=1,minimal-ui"> - minimal-ui is likely what causes this. We'll be removing it soon, so lighthouse may actually start to correctly score accessibility on the reported page once you read this.

Edit: fwiw in Lighthouse we've been using https://github.com/dontcallmedom/metaviewport-parser for a while. Weight-wise it's certainly heavier than your implementation, but it's quite careful and thorough.

All 7 comments

Yup @widmanski's guess was correct. :)

image

Thanks for reporting Paul. We're aware of this issue and have a fix for it in develop. Axe-core is a little in flux, with us working on 4.0 at the moment. This will be available in 4.0, which we have planned for early August.

@WilcoFiers With reference to the same github issue on lighthouse (reported by me), GoogleChrome/lighthouse#10908, I am getting below error message in accessibility with score returned as null.

axe-core Error: Cannot read property 'cells' of undefined in color-contrast
Follow this gist for lighthouse v6 result - https://gist.github.com/bhavin7181/ed97770e37bb8ea7087ae4977f9f618b#file-lighthouse-results-json-L4653

cc: @paulirish

@bhavin7181 we are currently working on a fix for that bug. It might be related to #2261 or #2262.

@straker Thanks for the quick response. Do we have ETA for the fix? Asking because that might change our timeline to upgrade LH to v6.0.0 :-)

It should make it into the 4.0 release.

Seems like the original bug is a dupe of https://github.com/dequelabs/axe-core/pull/2238 and we've also identified the other two for Bhavin's bug.

Thanks ya'll!

Was this page helpful?
0 / 5 - 0 ratings