mdbootstrap / mdb-react-ui-kit

React 18 & Bootstrap 5 & Material Design 2.0 UI KIT
https://mdbootstrap.com/docs/b5/react/
Other
1.41k stars 264 forks source link

Trying to close modal invoke an Error with React 16.2.0 #22

Closed hartatovich closed 6 years ago

hartatovich commented 6 years ago

when trying to close a modal i'm getting an error mdbreact.js:2046 Uncaught TypeError: Cannot read property 'contains' of undefined at Modal.handleBackdropClick

this is actually happens no matter where i click after the modal is open, clicking at the screen just invoking the error

inside my package.json

"react": "^16.2.0", "react-dom": "^16.2.0", "mdbreact":"git+https://github.com/mdbootstrap/React-Bootstrap-with-Material-Design.git#react-upgrade",

@smolenski-mikolaj :)

smolenski-mikolaj commented 6 years ago

Hi hartatovich,

It's weird, because I have the same configuration as You and modal works correct. Do You have more problems with other components or just with modal? Have You installed react-error-overlay as a dependency?

hartatovich commented 6 years ago

yeah i have "react-error-overlay": "4.0.0" in my package.json :) i don't see any problem in other components

@smolenski-mikolaj looks like the problem is in with this line of code dist/mdbreact.js if (e.target && !container.contains(e.target) && this.props.toggle) { this.props.toggle(); }

line 14938

smolenski-mikolaj commented 6 years ago

Thanks for letting us know. We've added that problem to our list of bugs and try to fix it in one of the next releases. I let You know here when the solution will be found.

shaggyrec commented 6 years ago

have same issue. Temporary fixed by backdrop={false}, but I hope for your correction in the core of the library

zanerock commented 6 years ago

There's a similar issue with a long discussion on the react-bootstrap project.

mattonit commented 6 years ago

Fixed