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

R19 support #1343

Closed
timfishercs opened this issue Sep 13, 2024 · 7 comments
Closed

R19 support #1343

timfishercs opened this issue Sep 13, 2024 · 7 comments

Comments

@timfishercs
Copy link

Description

R19 doesn't support findDOMNode, is there any plans to remove references to it?

Warning: findDOMNode is deprecated and will be removed in the next major release. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-find-node at FocusTrap (/.node_modules/focus-trap-react/dist/focus-trap-react.js:47:5)

Versions

  • Browser/OS verion(s) involved:
  • focus-trap-react version used: latest

Sandbox
Minimal reproduction in something like CodeSandbox:

  • If you can repro it in focus-trap, even better as that will exonerate focus-trap-react which tries to just be a wrapper for the real library.
  • If you can't repro it there, that's helpful too since it points to focus-trap-react as the culprit.

Screen Capture
Recording or screenshot of what you're seeing -- if the repro isn't sufficient to explain it.

@stefcameron
Copy link
Member

@timfishercs Thanks for asking. This library's use of findDOMNode was long-since been removed (back in 2022), see #710 🎉

I've been casually working on R19 support and, having reviewed all the upcoming changes, the only thing that really needs to be done is strip-out the propTypes and remove the dependency on the prop-types package since that will just be ignored now by R19.

The one thing I will do, however, as part of "supporting" R19 is cut a new major where I'll set the minimum supported version of React to 18.3.x Right now, the minimum is ancient, back to R16, and that's too much to support going forward given R18 has been around for nearly 2 years already.

So for all intents and purposes, focus-trap-react should already be ready for R19 -- unless you're seeing something I'm not?

@timfishercs
Copy link
Author

@stefcameron My apologies, there were sub packages using the older version. All the tests pass so I presume everything is ok, will verify. Nice work keeping it up to date!

@timfishercs timfishercs closed this as not planned Won't fix, can't repro, duplicate, stale Sep 15, 2024
@stefcameron
Copy link
Member

Cool! Thanks for adding your resolution and closing the issue. 😀

@VercammenJens
Copy link

Hey @stefcameron, I am getting an error related to R19 (not a breaking error currently):
Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.

Is this also something you are looking at?

stefcameron added a commit that referenced this issue Dec 31, 2024
…-19 way

`child.ref` is deprecated, and generates a warning in the console in R19
because refs are now first-class props.

Check the React version at runtime and if `>=19`, access it via the props;
otherwise, keep accessing it as before (a property of the child React element
object).
stefcameron added a commit that referenced this issue Dec 31, 2024
…-19 way

`child.ref` is deprecated, and generates a warning in the console in R19
because refs are now first-class props.

Check the React version at runtime and if `>=19`, access it via the props;
otherwise, keep accessing it as before (a property of the child React element
object).
stefcameron added a commit that referenced this issue Dec 31, 2024
…-19 way

`child.ref` is deprecated, and generates a warning in the console in R19
because refs are now first-class props.

Check the React version at runtime and if `>=19`, access it via the props;
otherwise, keep accessing it as before (a property of the child React element
object).
@stefcameron
Copy link
Member

@VercammenJens Thank you for pointing this out! It wasn't on my radar, but I've got it fixed in #1416 😄

@stefcameron
Copy link
Member

@all-contributors add @VercammenJens for bug

Copy link
Contributor

@stefcameron

I've put up a pull request to add @VercammenJens! 🎉

stefcameron added a commit that referenced this issue Dec 31, 2024
…-19 way

`child.ref` is deprecated, and generates a warning in the console in R19
because refs are now first-class props.

Check the React version at runtime and if `>=19`, access it via the props;
otherwise, keep accessing it as before (a property of the child React element
object).
stefcameron added a commit that referenced this issue Dec 31, 2024
…1416)

[#1343] Fix React 19 deprecation warning when accessing child ref pre-19 way

`child.ref` is deprecated, and generates a warning in the console in R19
because refs are now first-class props.

Check the React version at runtime and if `>=19`, access it via the props;
otherwise, keep accessing it as before (a property of the child React element
object).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants