-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[Modal] Fixed animation issue present in async Modal rendering #2076
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking this on, @mitchmaps!! 🎩 👀 👍Add a note to UNRELEASED.md && ![]()
1fbd7c5 to
493703f
Compare
| ### Enhancements | ||
|
|
||
| ### Bug fixes | ||
| - Fixed animation for Modal when being rendered asynchronously ([#2076](https://github.com/Shopify/polaris-react/pull/2076)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would probably just say 'when being mounted with open:true directly' or something like that?
Rendering the modal asynchronously using react-async is one of the scenario where it's mounted directly with open:true but there are others.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch, thanks!
|
|
||
| const fadeUpClasses = { | ||
| appear: classNames(styles.animateFadeUp, styles.entering), | ||
| appearActive: classNames(styles.animateFadeUp, styles.entered), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
loic-d
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎩 💯
I noticed that we have the same transition issue when closing the Modal using the open && <Modal open ... /> pattern.
import React, {useState} from 'react';
import {Page, Modal, Button} from '../src';
export function Playground() {
const [active, setActive] = useState(false);
const handleChange = () => {
setActive(!active);
};
return (
<Page title="Playground">
<div style={{height: '500px'}}>
<Button onClick={handleChange}>Open</Button>
{active && (
<Modal
open
onClose={handleChange}
title="Reach more shoppers with Instagram product tags"
primaryAction={{
content: 'Add Instagram',
onAction: handleChange,
}}
secondaryActions={[
{
content: 'Learn more',
onAction: handleChange,
},
]}
>
<Modal.Section>
<p>
Use Instagram posts to share your products with millions of
people. Let shoppers buy from your store without leaving
Instagram.
</p>
</Modal.Section>
</Modal>
)}
</div>
</Page>
);
}
I would still 🚢 this PR in the meantime 👍
493703f to
aa44f83
Compare
|
🎉 Thanks for your contribution to Polaris React! |
Why are these changes introduced?
Fixes #1897
What issue is this pull request addressing?
The normal fade up animation present in the modal component currently doesn't appear when setting the component directly to true.
What is this pull request doing?
This PR addresses this by appending additional
appearanimation classes to the component so its consistent throughout. S/o to @dleroux for suggesting this solution in the issue 🙏Click to view collapsed before and after gifs
Before
After
If you have any questions reach out to @ mitchell.soares on Slack!