Closed Ruslan101 closed 1 month ago
This seems not very clean and easy to fix. Any solution is going to involve merging refs, if I'm not mistaken. Not impossible, but it's not gonna be pretty.
Given the advances in JS, particularly the contains
function, there might finally be a simple solution here, since we only need the HoC's own ref to determine whether clicks are inside or outside of the local DOM tree. I'll see if I have some time soon to pen a revision.
Any update on this issue :) ?
If you're using hooks: yes. If you're using component classes, not yet.
No time estimate on when it'll get done either, but if you want to pay for the time necessary to fix this, feel free to reach out and I can move this up to the top of the queue to get it done in the next few days.
What amount of funding might you need to resolve this? @Pomax
Uplifting dependencies and testing for v17, updating the code and writing additional test, updating the docs, and "not spending time on the things that were on the top of the to-do list" would probably put it at around $1000 (which I fully realise is well beyond the donation budget of an individual, but is a trivial one-time expense for a company that relies on open source)
It will be removed in React 19, see: https://react.dev/blog/2024/04/25/react-19-upgrade-guide#removed-reactdom-finddomnode
Thankfully ("thankfully"), no one needs this HoC anymore because React unfortunately went all-in on hooks, and the README.md gives you alternative code that'll do what you want without needing to install anything.
I used the react-onclickoutside (6.12.0) and I got this warning from React:
Warning: findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of AddExtModal which is inside StrictMode. 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 onClickOutside (http://mySiteName/static/js/vendors~main.chunk.js:77178:26)