miljodir / md-components

Design-komponenter for Miljødirektoratet (CSS og React)
https://miljodir.github.io/md-components
MIT License
2 stars 2 forks source link

[Not a bug] Modal event propagation #147

Closed thomaslarsson closed 2 months ago

thomaslarsson commented 2 months ago

After some trial and error, we found out that the event propagation (naturally) only happened when the MdModal was a child element of an element with a click-handler. A real life problem happened due to this as well, even though the modal was moved in the DOM using a portal. Why this works is beyond the scope of this issue.

Similar problems can be solved by moving the component outside the problematic click handler. Another solution is to wrap the Modal element itself with a handler that stops propagation upwards towards the problematic parent.

The behavior is not a bug itself with the component library. I'm therefore closing this issue.

github-actions[bot] commented 2 months ago

Please set a versioning label of either major, minor, or patch to the pull request.