FocusMonitor TypeError: Cannot read property 'remove' of undefined (classlist)
See original GitHub issueWhile using @angular/cdk ~10.2.2 and @angular/material ^10.2.2 I keep encountering the following error:
TypeError: Cannot read property 'remove' of undefined
at FocusMonitor._toggleClass (a11y.js:1928)
at FocusMonitor._setClasses (a11y.js:1957)
at FocusMonitor.stopMonitoring (a11y.js:1897)
at MatTooltip.ngOnDestroy (tooltip.js:249)
at executeOnDestroys (core.js:9070)
at cleanUpView (core.js:8992)
at destroyViewTree (core.js:8796)
at destroyLView (core.js:8945)
at RootViewRef.destroy (core.js:9679)
at ComponentRef$1.destroy (core.js:22234)
at resolvePromise (zone.js:1215)
at resolvePromise (zone.js:1165)
at zone.js:1277
at ZoneDelegate.invokeTask (zone.js:407)
at Object.onInvokeTask (core.js:27418)
at ZoneDelegate.invokeTask (zone.js:406)
at Zone.runTask (zone.js:179)
at drainMicroTaskQueue (zone.js:583)
The error occurs when I navigate from one page to the other. I noticed the MatTooltip class in the stacktrace, and I’d like to note that while many of the components on the page use tooltips, none were active during the time of navigation (this was instigated by a div with routerLink inside a MatMenu). The error appears to completely break the website, leaving only a background color. Refreshing the page successfully completes the navigation. If any further information is needed, please let me know.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Having trouble fixing "Uncaught TypeError: Cannot read ...
getElementsByClassName() returns an array (collection). It's the source of the "undefined" and thus .remove() and .classList() are not methods ...
Read more >cannot read property 'classlist' of undefined javascript
I'm practicing a challenge of making an order checkout page. And I have made a few payment options using the radio button.
Read more >Error: Cannot read properties of undefined (reading 'remove ...
My issue is that when I press the next button, I get the following error. Error: Cannot read properties of undefined (reading 'remove')....
Read more >HTML DOM Element classList Property - W3Schools
The classList property is read-only, but you can use the methods listed below, to add, toggle or remove CSS classes from the list: ......
Read more >Cannot read property 'classList' of null in Gatsbyjs - Reddit
TypeError : Cannot read property 'classList' of null. I am trying to make a navbar that changes color and background color when you...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@crisbeto This does indeed seem to fix the issue. Thanks for your help! I hope this helps to track down any potential bug/issue with the (mis)handling of Angular components.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.