Open
Conversation
Author
|
Hello @arturbien! This small fix is critical for those on React 19+ using React95 For anyone else running into this issue, you can create a patch as a temporary fix: diff --git a/node_modules/react95/dist/common/hooks/useIsFocusVisible.js b/node_modules/react95/dist/common/hooks/useIsFocusVisible.js
index 6a14447..cbe8726 100644
--- a/node_modules/react95/dist/common/hooks/useIsFocusVisible.js
+++ b/node_modules/react95/dist/common/hooks/useIsFocusVisible.js
@@ -3,7 +3,6 @@
Object.defineProperty(exports, '__esModule', { value: true });
var React = require('react');
-var reactDom = require('react-dom');
let hadKeyboardEvent = true;
let hadFocusVisibleRecently = false;
@@ -78,7 +77,7 @@ function handleBlurVisible() {
}
function useIsFocusVisible() {
const ref = React.useCallback((instance) => {
- const node = reactDom.findDOMNode(instance);
+ const node = instance;
if (node != null) {
prepare(node.ownerDocument);
}
diff --git a/node_modules/react95/dist/common/hooks/useIsFocusVisible.mjs b/node_modules/react95/dist/common/hooks/useIsFocusVisible.mjs
index afef844..5160830 100644
--- a/node_modules/react95/dist/common/hooks/useIsFocusVisible.mjs
+++ b/node_modules/react95/dist/common/hooks/useIsFocusVisible.mjs
@@ -1,5 +1,4 @@
import { useCallback } from 'react';
-import { findDOMNode } from 'react-dom';
let hadKeyboardEvent = true;
let hadFocusVisibleRecently = false;
@@ -74,7 +73,7 @@ function handleBlurVisible() {
}
function useIsFocusVisible() {
const ref = useCallback((instance) => {
- const node = findDOMNode(instance);
+ const node = instance;
if (node != null) {
prepare(node.ownerDocument);
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Remove
findDOMNode(React 19 compatibility)ReactDOM.findDOMNodewas removed in React 19. TheuseIsFocusVisiblehookwas calling it to resolve the DOM node from a ref callback, which breaks
entirely in React 19.
The fix is straightforward — ref callbacks already receive the DOM node as
instance, sofindDOMNodewas never doing anything useful here. Droppingit and using
instancedirectly is equivalent behavior.Fixes the following crash when running React 19:
TypeError: reactDom.findDOMNode is not a function