react-input-range icon indicating copy to clipboard operation
react-input-range copied to clipboard

TypeError on ownerDocument for onChangeComplete with re-rendering

Open willrp opened this issue 8 years ago • 5 comments

Hello. First I would like to thank you for your excelent job. This range component is really good.

The following error is happening when the event 'onChangeComplete' is triggered, at this file.

Uncaught TypeError: Cannot read property 'ownerDocument' of null at InputRange.removeDocumentMouseUpListener at InputRange.handleMouseUp

When I try that event with something simple, like console.log, it does not show the error. It only happens because I'm changing state and redux is rendering my components again.

If it's a ref issue, I would like to know how should I input the ref for the InputRange, so the following error does not happen. The component is working flawlessly, this is the only problem, popping this error in my console.

This is happening on input-range.jsx:309.

Thanks in advance.

willrp avatar Jun 25 '17 06:06 willrp

Getting same issue. Any known solutions?

eoghanmccarthy avatar May 09 '18 18:05 eoghanmccarthy

Same issue here

paschaldev avatar Dec 04 '18 10:12 paschaldev

As a workaround I had to wrap the event handler in a setTimeout with 100ms of delay.

M0ns1gn0r avatar May 15 '20 09:05 M0ns1gn0r

Whatever you are doing inside onChangeComplete , wrap it with setTimeout function like this:

onChangeComplete={ value => { setTimeout(() => { //function after change complete }, 1000); } }

AnupamRawal avatar Sep 07 '21 09:09 AnupamRawal

After adding the setTimeout the error goes away but the slider UI goes back to its original state

shaantalk avatar Jul 20 '22 13:07 shaantalk