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.
Commit 6e2018e fixed the PID row text input bug where we were getting
activeElement.detachEvent is not a function
errors when clicking on text inputs in PID rows.The fix involved importing
createRoot
dynamically. Otherwise, if imported at the top of the file, becausewindow
would beundefined
,canUseDOM
would befalse
inreact-dom
'sreact-dom.js
, which in turn makesisInputEventSupported
befalse
, which then makeshandleEventsForInputEventPolyfill
be called, which in the end makesactiveElement.attachEvent()
andactiveElement.detachEvent()
be called, which are bothundefined
.However, as a result of importing
createRoot
dynamically, nowcanUseDOM
istrue
, and the following line inreact-dom-js
is run:However,
navigator
is not defined and an error is thrown. This is why a patch toreact-dom
was applied in f1792e7. I think a simpler patch could be applied that simply pointsnavigator
towindow.navigator
ifundefined
.Anyways, I feel this whole fix is a little difficult to follow. Apparently a more straightforward fix may be possible (based on capricorn86/happy-dom/issues/534) which simply patches
react-dom
by replacingactiveElement.attachEvent()
andactiveElement.detachEvent()
calls withactiveElement.addEventListener()
andactiveElement.removeEventListener()
calls, respectively.I have tested it and it seems to work. But because I'm not sure what the "PID row text input bug" before the original fix implied exactly, I would appreciate @Dominic-DallOsto's comments before merging.