question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to animate AnimatedDialogContent's "translateY" in with "overflow: hidden"

See original GitHub issue

🐛 Bug report

Current Behavior

When using @reach/dialog with react-spring, the AnimatedDialogContent component — created with animated(DialogContent) — is unable correctly animate from translateY(100%) to translateY(0%) with overflow: hidden set on the AnimatedDialogOverlay. Instead, the AnimatedDialogContent appears at it’s end position (translateY(0%)) and has some odd jank going on.

https://user-images.githubusercontent.com/19195374/107703683-9e754a80-6c81-11eb-9e99-e5b5757f57b1.mp4

Expected behavior

I expected the AnimatedDialogContent to slide up from the bottom of the screen. I created an example of this without @reach/dialog to demonstrate what it should look like:

https://user-images.githubusercontent.com/19195374/107704003-2eb38f80-6c82-11eb-8f02-b106df354734.mp4

Reproducible example

CodeSandbox for Reach UI’s Dialog reproduction

CodeSandbox for working example without Reach UI’s Dialog

Suggested solution(s)

I have no clue why this happens and I couldn’t find any information by looking at the source code for the Dialog components.

Your environment

Software Name(s) Version
Reach Package @reach/dialog 0.13.0
React react, react-dom 17.0.1
Browser Chrome Beta, Chrome, Firefox 89.0.4389.40, 88.0.4324.150, 86.0b8
Operating System Windows

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
indiesquidgecommented, Feb 16, 2021

@ChrisBrownie55 thanks for the further explanation. My initial comments were less about including Reach’s default styles as the solution and more about some of the custom styling as the problem, but I overlooked the exactness of the your expected behavior, my mistake.

This appears to be a consequence of react-focus-lock’s FocusLock’s autoFocus prop. (Here is a fork of your sandbox working example without Reach’s Dialog showing the issue.) FocusLock is used within Dialog with a few props hardcoded, but you can get around this by passing true for the DialogOverlay’s dangerouslyBypassFocusLock. If you do this, it is recommended that you then supply your own focus trap to keep the tab sequence locked within the modal contents. It would be worth digging into that library to figure out which options suit your needs best while still keeping your implementation as accessible as possible.

0reactions
andria-devcommented, Feb 23, 2021

I do feel like this information should be added to the animation section of the documentation though as it is not at all evident in any manner that I was supposed to do this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CSS animation won't work with 'overflow: hidden;'
I've narrowed it down to that it's got something to do with the 'overflow: hidden' attribute, because the animation will actually work when...
Read more >
Transitioning Hidden Elements - Cloud Four
Hidden elements can not be transitioned since they're not in the document flow. However, we can get around this by forcing the document...
Read more >
Animation With Svelte - Joy of Code
I want the text to appear from the bottom of the element instead of fading in from the starting y position, so I...
Read more >
Velocity.js
animate (). It works with and without jQuery. It's incredibly fast, and it features color animation, transforms, loops, easings, SVG support, and scrolling....
Read more >
Animation - Reach UI
Guidelines for animating components in Reach UI. ... However, you can't animate the "exit" phase with just CSS because React removes the element...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found