meta-viewport: Cannot read property 'toLowerCase' of undefined
See original GitHub issueWe’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-uiis 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.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (5 by maintainers)

Top Related StackOverflow Question
It should make it into the 4.0 release.
@bhavin7181 we are currently working on a fix for that bug. It might be related to #2261 or #2262.