seas-computing / mark-one

A UI component library for building React Apps (in development)
https://seas-computing.github.io/mark-one/
BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

Refactor fix for Modal background click behavior #138

Closed jonseitz closed 1 year ago

jonseitz commented 1 year ago

Describe your changes

While trying to test #137 in the course planner[1], I wound up seeing a few dozen test failures that seemed to be related to the closing behavior of the modal. It seems that there were two issues:

  1. Removing the evt.preventDefault() call on the Modal itself was causing some click events to register on the backdrop, closing the modal before it should have.
  2. Defining the mouseDownOnModal field in the render function was causing it to revert to false when the component re-rendered, preventing the modal from closing when it should have.

At least, I think that's what was happening. I don't think either of those were really registering as issue when manually testing the browser, but I suspect something in the testing library click event handling was causing the unexpected behavior.


[1]: I tested this by first transpiling the code in mark-one with:

tsc --project=tsconfig.publish.json

Then copying the built files into my copy of course-planner:

cp -r /path/to/mark-one/lib /path/to/course-planner/node-modules/mark-one/lib

Types of changes

Checklist:

Priority:

Related Issues:

Fixes #___