xrutayisire / react-js-cron

A React cron editor built with antd
https://xrutayisire.github.io/react-js-cron/?path=/docs/reactjs-cron--demo
MIT License
247 stars 106 forks source link

Fix onMouseDown event propagation where antd Select component is used #50

Closed matt-koevort closed 1 year ago

matt-koevort commented 1 year ago

🤔 This is a ...

🔗 Related issue link

💡 Background and solution

If the Cron component is rendered inside of a component that has MouseEvent handlers, clicking on a dropdown item causes the ancestor component's MouseEvent handler to trigger. For ancestor's like modals, this behaviour is not desirable as it causes the modal to close (in most circumstances).

Handling this by explicitly stopping event propagation for the antd Select component.

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 62.50% and project coverage change: -0.19 :warning:

Comparison is base (5d8585e) 84.75% compared to head (ec3d12e) 84.56%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #50 +/- ## ========================================== - Coverage 84.75% 84.56% -0.19% ========================================== Files 12 12 Lines 492 499 +7 Branches 197 198 +1 ========================================== + Hits 417 422 +5 - Misses 12 13 +1 - Partials 63 64 +1 ``` | [Impacted Files](https://codecov.io/gh/xrutayisire/react-js-cron/pull/50?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Xavier+Rutayisire) | Coverage Δ | | |---|---|---| | [src/components/CustomSelect.tsx](https://codecov.io/gh/xrutayisire/react-js-cron/pull/50?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Xavier+Rutayisire#diff-c3JjL2NvbXBvbmVudHMvQ3VzdG9tU2VsZWN0LnRzeA==) | `70.45% <50.00%> (-0.63%)` | :arrow_down: | | [src/fields/Period.tsx](https://codecov.io/gh/xrutayisire/react-js-cron/pull/50?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Xavier+Rutayisire#diff-c3JjL2ZpZWxkcy9QZXJpb2QudHN4) | `58.97% <100.00%> (+2.21%)` | :arrow_up: | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Xavier+Rutayisire). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Xavier+Rutayisire)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

xrutayisire commented 1 year ago

Hello, thanks for the MR!

I let you handle prettier problems and also can you add a test to cover the bug you found?