Skip to content

Fixes ReferenceError: document is not defined #273

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

Closed
wants to merge 1 commit into from
Closed

Fixes ReferenceError: document is not defined #273

wants to merge 1 commit into from

Conversation

catamphetamine
Copy link

Fixes #272

ReferenceError: document is not defined

ariaAppHider.js:5 Object.setElement
[frontend]/[react-responsive-ui]/node_modules/react-modal/lib/helpers/ariaAppHider.js

ReferenceError: document is not defined

ariaAppHider.js:5 Object.setElement
[frontend]/[react-responsive-ui]/node_modules/react-modal/lib/helpers/ariaAppHider.js
@catamphetamine
Copy link
Author

Actually the change should be this instead:

function setElement(element) {
  if (typeof element === 'string') {
    if (typeof document === 'undefined') {
      return _element;
    }
    var el = document.querySelectorAll(element);
    element = 'length' in el ? el[0] : el;
  }
  _element = element || _element;
  return _element;
}

@catamphetamine
Copy link
Author

Seems that I've been calling setElement by myself to fix "call setBodyElement" bug.

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

Successfully merging this pull request may close these issues.

1 participant