question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Menu] Cannot read property 'length' of null

See original GitHub issue

Intermittently I get this error when using a Menu component. It happens after clicking a menu item.

The line where the item is thrown is 388 of the menu/index.js:

if (focusableItems && focusableItems.current.length > 0) {

I think the fix is quite simple: focusableItems is created with useRef, so this line should be checking that focusableItems.current is not null:

if (focusableItems.current && focusableItems.current.length > 0) {

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:19 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
tafelitocommented, Oct 17, 2020

I’m seeing this same error but only when using usePortal property. The error seems to be different than the OP since that was already fixed. Anyone has seen this in 0.8?

1reaction
JWeiscommented, Sep 18, 2020

That was the issue. I hade MenuItem directly under Menu in the parent component which was why I was seeing the last error. All working now. Thank you!!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot read property "length" from null - ServiceNow
I have written a script to find some specific content from all HTML fields from knowledge articles but getting below error when there...
Read more >
[Solved] TypeError: Cannot read property 'length' of null
This error indicates that the code is trying to compute the length property on a null variable. A null variable holds no or...
Read more >
Cannot read property 'length' of null - jquery - Stack Overflow
Having no idea about the nature of ajax result and what you are trying to do, here is the correct syntax for processing...
Read more >
Chrome: Cannot read property 'length' of null - Google Groups
Cannot read property 'length' of null. The same page in FireFox works ok. Best regards, Zdravko. Andrew Gallant's profile photo ...
Read more >
Jqgrid Error "Uncaught TypeError: Cannot Read Property ...
Jqgrid Error "Uncaught TypeError: Cannot Read Property 'length' Of Null" (Doc ID 2207846.1) · 1. Login to Siebel application using Chrome browser ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found