Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReferenceError: Element is not defined #59

Closed
elliottsj opened this issue Mar 11, 2019 · 5 comments
Closed

ReferenceError: Element is not defined #59

elliottsj opened this issue Mar 11, 2019 · 5 comments
Assignees

Comments

@elliottsj
Copy link

I started getting this error in version 1.18.2:

ReferenceError: Element is not defined
    at Object.<anonymous> (/Users/spencerelliott/Dev/path/to/common/temp/node_modules/.registry.npmjs.org/react-focus-lock/1.18.2/[email protected]/node_modules/react-focus-lock/dist/cjs/Lock.js:195:44)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/Users/spencerelliott/Dev/path/to/common/temp/node_modules/.registry.npmjs.org/react-focus-lock/1.18.2/[email protected]/node_modules/react-focus-lock/dist/cjs/index.js:34:36)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)

I think it was introduced in this commit: 7bc46f0#diff-757809db6137e7d28cf62c382a00aeadR147

@theKashey
Copy link
Owner

🤷‍♂️all tests are green 🤷‍♂️

@theKashey theKashey self-assigned this Mar 11, 2019
@theKashey
Copy link
Owner

Ok, so the question is - what your browser? Element is defined for me as window.Element

@theKashey
Copy link
Owner

I've just made it any. Anyway - I don't believe in prop types, almost all IDEs could use d.ts.
Try 1.18.3

@elliottsj
Copy link
Author

Ah, I'm realizing now that the error was occurring since I'm using Next.js, and of course window.Element is not defined in Node.js when server-side rendering.

@theKashey
Copy link
Owner

Got it, so my jsdom/register, I am using for tests, was letting them pass.

nickspaargaren pushed a commit to nickspaargaren/react-focus-lock that referenced this issue Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants