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.

[BUG] motion.custom does not recognize reach-ui components

See original GitHub issue

2. Describe the bug

When using reach-ui components, motion.custom is unable to find component refs, despite the library properly exposing forwardRef. I suspect that this has something to do with Reach’s implementation of useForkedRef, which allows them to support internal and passed refs at the same time. It looks like useForkedRef assigns refs lazily, so it’s possible that motion is simply too eager in validating refs?

Happy to cross-reference this with Reach if you think this is an implementation issue on their end.

3. IMPORTANT: Provide a CodeSandbox reproduction of the bug

CodeSandbox minimal reproduction will be added shortly.

4. Steps to reproduce

Steps to reproduce the behavior:

  1. Install @reach/tooltip
  2. Render a wrapped motion.custom(TooltipPopup)
  3. See console error
Error: Uncaught [Error: No 'ref' found. Ensure components created with motion.custom forward refs using 'React.forwardRef']

5. Expected behavior

I expect motion.custom to resolve the correct ref, since their ref assignment is handled properly by React, albeit lazily.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:5

github_iconTop GitHub Comments

2reactions
fknopcommented, Jan 5, 2020

I’m having the same issue, any workaround for the moment?

0reactions
mattgperrycommented, Feb 19, 2021

Feel free to reopen with a sandbox. I don’t think this is a bug on our end though, we pass the ref as a function and mount when React hydrates it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unknown Prop with Framer Motion and React : r/webdev
I'm trying to use Framer Motion to animate Reach UI's dialog component, however, I see this error in this console and I'm unable...
Read more >
Next.js "_framerMotion.motion.custom is not a function"
In this version, framer-motion automatically filters out motion-related props forwarded to the provided component. That means, in most cases, ...
Read more >
How to satisfy accessibility criteria with UX copywriting?
UX designers are often asked to write button text, link text, and more. So, how to match accessibility criteria with UX copywriting?
Read more >
Building Accessible Menu Systems - Smashing Magazine
By supporting inclusive-components.design on Patreon, you can ... ARIA menus are not designated for navigation but for application behavior.
Read more >
Creating accessible color palettes for human eyes
We can see that hue does not affect anything except how our colors look. The rest of the values is similar, including contrast....
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