Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: slide modal out on other side #167

Merged
merged 8 commits into from
Aug 24, 2022
Merged

fix: slide modal out on other side #167

merged 8 commits into from
Aug 24, 2022

Conversation

zzmp
Copy link
Contributor

@zzmp zzmp commented Aug 24, 2022

This PR changes the transition behavior for modals.

If there is another dialog taking the place of an active one, the old dialog will slide out to the left (instead of to the right). In code, this is called "PAGING". This avoids risking exposing the screen underneath modals when they are replacing each other, and makes the modals look more sequenced.

It also fixes some issues I discovered while implementing this:

Before

Screen.Recording.2022-08-24.at.9.55.25.AM.mov

After

Screen.Recording.2022-08-24.at.1.23.46.PM.mov

@zzmp zzmp requested a review from infredible August 24, 2022 16:54
@vercel
Copy link

vercel bot commented Aug 24, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
widgets ✅ Ready (Inspect) Visit Preview Aug 24, 2022 at 9:39PM (UTC)

Copy link
Contributor

@JFrankfurt JFrankfurt left a comment

Choose a reason for hiding this comment

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

This results in an unexpected animation (imo) when clicking the back arrow on this screen:
image

can you make this change conditional on transaction submission instead of universal?

@zzmp
Copy link
Contributor Author

zzmp commented Aug 24, 2022

This results in an unexpected animation (imo) when clicking the back arrow on this screen: image

can you make this change conditional on transaction submission instead of universal?

To clarify (from @JFrankfurt):

I don’t expect the back arrow pointing left < to send the screen that direction
I expect it to send the screen back the direction it came (to the right)
I think this change is a much improved transition to the next screen, but a worse experience when hitting “back” from the swap summary

@zzmp zzmp requested a review from JFrankfurt August 24, 2022 20:37
@vercel vercel bot temporarily deployed to Preview August 24, 2022 20:38 Inactive
@infredible
Copy link

lgtm

@zzmp zzmp requested a review from vm August 24, 2022 21:16
/** Used when the Dialog is closing. */
CLOSING = 'closing',
/** Used when the Dialog is paging to another Dialog screen. */
PAGING = 'paging',
Copy link
Contributor

Choose a reason for hiding this comment

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

perhaps a good place to explain the concept of paging and why it's important

src/components/Widget.tsx Outdated Show resolved Hide resolved
parent.removeChild = function <T extends Node>(child: T) {
if ((child as Node) === current) {
current.classList.add(UNMOUNTING)
const klass = typeof animatingClass === 'string' ? animatingClass : animatingClass()
Copy link
Contributor

Choose a reason for hiding this comment

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

not sure i'm following here. why could animating class be a class or string?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've narrowed the type (to a callback) and tried to explain why this is a callback (and not a string) through comments.

@vercel vercel bot temporarily deployed to Preview August 24, 2022 21:31 Inactive
@zzmp zzmp requested a review from vm August 24, 2022 21:38
@vercel vercel bot temporarily deployed to Preview August 24, 2022 21:39 Inactive
@zzmp zzmp dismissed JFrankfurt’s stale review August 24, 2022 21:42

I've included the changes requested in this review.

@zzmp zzmp merged commit 76fcbdc into main Aug 24, 2022
@zzmp zzmp deleted the smoother-modals branch August 24, 2022 21:42
@github-actions
Copy link

🎉 This PR is included in version 2.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants