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.

Cannot read property 'ownerDocument' of null

See original GitHub issue

I’m getting this error thrown by the tabbable library which focus-trap-react depends on by way of focus-trap. At first I thought this might be a jest/enzyme problem but I’m also seeing it in non-test code.

TypeError: Cannot read property 'ownerDocument' of null
    at tabbable (index.js:21)
    at updateTabbableNodes (index.js:267)
    at Object.activate (index.js:72)
    at FocusTrap.componentDidMount (focus-trap-react.js:55)

I also noticed that the line that’s throwing this error is an older version than your most recent update of tabbable…perhaps a version update would help? I haven’t tested that yet, but I would love any input you have.

I’ve used this library before and had really great results with it, so thanks!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:7
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

6reactions
jimmaaaycommented, Oct 18, 2019

I found that if the child of FocusTrap isn’t a HTML element then this error pops up.

E.g

Errors with Cannot read property 'ownerDocument' of null

<FocusTrap>
  <Fragment>
    {/* ...content */}
  </Fragment>
</FocusTrap>

Works

<FocusTrap>
  <div>
    {/* ...content */}
  </div>
</FocusTrap>

You can see an example here. Make sure its set to current module view. And checkout will-error.js & works.js

1reaction
davidtheclarkcommented, May 19, 2019

@lukeschunk can you please be more specific about the situation in which this behavior is happening? This does not happen universally — for example, I’m not seeing it in the demos — so I think we need to identify what you and @pradel are doing that triggers the error.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught TypeError: Cannot read property 'ownerDocument ...
I think my view is returning proper JSON but now data is not being added to the .mainContent div. It gives this error:...
Read more >
Can not read property ownerDocument of null #542 - GitHub
I am getting TypeError: Cannot read property 'ownerDocument' of null even if all the required props are passed to Container and element.
Read more >
Cannot read property 'ownerDocument' of undefined - Laracasts
I put a child component called <page-buttons> in my main Vue component. This component has some buttons floating on the page.
Read more >
cannot read properties of null (reading 'ownerdocument')
I am getting TypeError: Cannot read property 'ownerDocument' of null even if all the required props are passed to Container and element. Line...
Read more >
Cannot read property ownerDocument of null - Mendix Forum
actionButton2: Cannot read property 'ownerDocument' of null Error: An error occurred while executing On click at Linegenix.Location_NewEdit.
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