-
Notifications
You must be signed in to change notification settings - Fork 812
[fixed] Ensure after-open css transitions work in Safari 14 & Mobile Safari #847
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
[fixed] Ensure after-open css transitions work in Safari 14 & Mobile Safari #847
Conversation
Hey @diasbruno, it's been a while since I created this PR. Yes, using What are your thoughts on this? Would you like me to: |
@benjaminpadula Can you try adding a class (with default properties like |
Any updates on this issue? Is there another PR to watch for a different approach to fix this? Is there any workaround in the meantime? |
@pwfisher You can try @benjaminpadula's branch...It would help validate the fix. |
Seems I can't, and I think it's due to an error in react-modal's package.json: its "main" entry points to a nonexistent file.
Error: Cannot find module '/Users/patrickfisher/Code/figs/syconium/node_modules/react-modal/lib/index.js'. Please verify that the package.json has a valid "main" entry |
Use the https version: On your react-modal: "https://github.com/benjaminpadula/react-modal#fix/css-after-open-transition-in-safari-14" |
@pwfisher @diasbruno ran into a similar problem. There are no other changes from @benjaminpadula's branch |
@diasbruno Sure, do you want me to make a PR against the master branch of |
@atomanyih Yes, that would be great. |
Any updates on the status of your branch? Will it be merged soon? Thnx |
Sorry for the delay on this...I'm going to push this PR forward as it doesn't seem to cause problems. |
Merged manually. See 827796d. Thanks, @benjaminpadula. |
@diasbruno are you planning to release a new version to NPM? |
Fixes #846.
Changes proposed:
requestAnimationFrame
to delay theafter-open
class from being added until it mounts with inital CSSUpgrade Path (for changed or removed APIs): n/a
Acceptance Checklist:
CONTRIBUTING.md
.Additional notes:
It struck me that perhaps the issue was that when the modal is mounted, it is immediately mounted with the open state and initially renders with the after-open class. It's actually kind of surprising, then that Chrome shows a transition, when technically nothing is really changing. Perhaps the old browser interpreter is inferring developer intent or doing something wrong. ¯\_(ツ)_/¯
So I thought it was worth a try to ensure that the modal mounts in the closed state first, and then apply the open class. (See modified sandbox) And that seems to do the trick! But since it's likely a problem affecting everyone, I decided to try fixing it directly in
react-modal
so everyone could benefit from working transitions in Safari 14 & mobile Safari.Moral: When using CSS transitions, ensure that the component is rendered first before applying the class that triggers the transition. Test in Safari 14 to ensure you got it right, as other/older browsers seem to be more lenient.