cleave.js icon indicating copy to clipboard operation
cleave.js copied to clipboard

Uncaught TypeError: Cannot read properties of undefined (reading 'activeElement')

Open RuellePaul opened this issue 2 years ago • 3 comments

When migrate to Vite 4, I'm getting this error :

Uncaught TypeError: Cannot read properties of undefined (reading 'activeElement')
    at Object.getActiveElement (cleave-react-node.js:2766:37)
    at Object.setSelection (cleave-react-node.js:2741:31)
    at ReactClassComponent.componentDidUpdate (cleave-react-node.js:103:15)
    at commitLifeCycles (react-dom.development.js:20684:24)
    at commitLayoutEffects (react-dom.development.js:23426:7)
    at HTMLUnknownElement.callCallback2 (react-dom.development.js:3945:14)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:3994:16)
    at invokeGuardedCallback (react-dom.development.js:4056:31)
    at commitRootImpl (react-dom.development.js:23151:9)
    at unstable_runWithPriority (scheduler.development.js:468:12)

I'm using the lib correctly 'cause it worked with CRA.

This code from this cleave-react-node seems involved :

getActiveElement: function getActiveElement(parent) {
   var activeElement = parent.activeElement;
   if (activeElement && activeElement.shadowRoot) {
      return this.getActiveElement(activeElement.shadowRoot);
   }
   return activeElement;
}

Do you have any idea what I can do ?

RuellePaul avatar Feb 02 '23 16:02 RuellePaul

@RuellePaul did you ever find a solution for this? running into the same problem.

jdavis-software avatar Sep 19 '23 17:09 jdavis-software

@RuellePaul did you ever find a solution for this? running into the same problem.

I changed for another library 😄

RuellePaul avatar Sep 21 '23 15:09 RuellePaul

@RuellePaul which library?

boydvoid avatar Oct 04 '23 18:10 boydvoid