Skip to content

Undefined error in contentHasFocus method #315

Closed
@saradacp

Description

@saradacp

Summary:

Got the following error in the browser console when using react modal
Uncaught TypeError: Cannot read property 'contains' of undefined
at Object.contentHasFocus (ModalPortal.js:171)
at Object.focusContent (ModalPortal.js:101)
at Object.componentDidUpdate (ModalPortal.js:66)
at measureLifeCyclePerf (ReactCompositeComponent.js:75)
at ReactCompositeComponent.js:729
at CallbackQueue.notifyAll (CallbackQueue.js:76)
at ReactReconcileTransaction.close (ReactReconcileTransaction.js:80)
at ReactReconcileTransaction.closeAll (Transaction.js:206)
at ReactReconcileTransaction.perform (Transaction.js:153)
at ReactUpdatesFlushTransaction.perform (Transaction.js:140)

Steps to reproduce:

  1. When populating contents in the modal dynamically

Expected behavior:

Should be able to populate contents without any errors.

Additional notes:

A small undefined check in the react-modal.js resolved the issue. Will make a PR with the fix.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions