Skip to content
This repository has been archived by the owner on Jan 20, 2022. It is now read-only.

Use onMouseDown instead of onClick for auto closing modals #342

Merged
merged 3 commits into from
Apr 23, 2021

Conversation

Jephuff
Copy link
Contributor

@Jephuff Jephuff commented Apr 22, 2021

This will prevent clicking in the modal and moving mouse outside from closing the modal

📦 Published PR as canary version: 8.20.2-canary.342.9199.0

✨ Test out this PR locally via:

npm install @apollo/space-kit@8.20.2-canary.342.9199.0
# or 
yarn add @apollo/space-kit@8.20.2-canary.342.9199.0

@Jephuff Jephuff added the bug fix Increment the patch version when merged label Apr 22, 2021
@Jephuff Jephuff force-pushed the jeffrey/use-mouse-down-instead-of-on-click branch from 7cd4921 to 66f408d Compare April 22, 2021 15:14
@Jephuff Jephuff force-pushed the jeffrey/use-mouse-down-instead-of-on-click branch from 66f408d to d007890 Compare April 22, 2021 15:23
@Jephuff Jephuff requested a review from a team April 22, 2021 15:30
Copy link
Member

@cheapsteak cheapsteak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 bit jarring to have it close before my finger moved up, but certainly better than what we have now

@Jephuff Jephuff requested a review from cheapsteak April 22, 2021 15:51
Copy link
Member

@cheapsteak cheapsteak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✨ 🚀

@@ -140,6 +140,11 @@ export const Modal: React.FC<Props> = ({
primaryAction,
secondaryAction,
}) => {
const mouseDownTarget = useRef<EventTarget | null>(null);
Copy link
Member

@cheapsteak cheapsteak Apr 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would we ever want this to store a reference to something other than the backdrop element?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope, are you thinking renaming to something like backdropMouseDownTarget?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes please 👍

I was briefly confused trying to figure out why weren't clearing out the reference in the onClick so the stale one isn't used again

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(feel free to merge at will following rename btw)

@Jephuff Jephuff enabled auto-merge (squash) April 22, 2021 16:01
@Jephuff Jephuff enabled auto-merge (squash) April 22, 2021 16:26
@Jephuff Jephuff disabled auto-merge April 22, 2021 20:35
@Jephuff Jephuff enabled auto-merge (squash) April 22, 2021 20:36
@cheapsteak cheapsteak merged commit be38199 into main Apr 23, 2021
@cheapsteak cheapsteak deleted the jeffrey/use-mouse-down-instead-of-on-click branch April 23, 2021 20:48
@apollo-bot2
Copy link
Collaborator

🚀 PR was released in v8.20.2 🚀

@apollo-bot2 apollo-bot2 added the released This issue/pull request has been released. label Apr 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug fix Increment the patch version when merged released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants