md-date-time-picker icon indicating copy to clipboard operation
md-date-time-picker copied to clipboard

DateTimePicker.js:981 - Uncaught TypeError: Cannot read property 'removeChild' of null

Open jqp5000 opened this issue 8 years ago • 9 comments

Hi there, while playing around with this great project I'm getting the above exception.

Steps to reproduce:

  • Open the default datepicker: // new mdDateTimePicker.default({type: 'date'});
  • Multi-click on the previous or next month arrow icon fast enough (5 clicks per second)
  • At some point, rather sooner than later, the API will break and the above exception will be thrown. As a result in the DOM the li.mddtp-picker__view element will start to grow.

It'll be great to have this issue fixed as this is a fairly easy-to-reproduce bug.

Thanks in advance.

jqp5000 avatar Jun 02 '16 21:06 jqp5000

Thanks for posting about this bug @jqp5000 I'll have a look at it.

puranjayjain avatar Jun 03 '16 01:06 puranjayjain

keeping it open until a solution could be found

puranjayjain avatar Nov 25 '16 14:11 puranjayjain

This seems to be a race condition. Reducing the timeout to 150 ms (i.e. not waiting until the month has finished its animation out of the dialog) prevents the issue. Really, setTimeout probably isn't a very robust way to handle these things.

qpoon avatar Feb 06 '17 23:02 qpoon

@qpoon I know but when I first started the development I was a front end noob 😝 and didnt know much js so this was the solution that came to my mind

puranjayjain avatar Feb 07 '17 02:02 puranjayjain

There are two solutions that have come to my mind for that:

  1. adding cancel timeouts to prevent the propogation of previous timeouts and setting timeout to 150ms
  2. detecting animation end and then doing stuff and canceling if a new one comes.

puranjayjain avatar May 27 '17 18:05 puranjayjain

@puranjayjain. Did you experiment those solutions? Are you planning to fix this bug?

papasax avatar Jul 11 '17 12:07 papasax

@papasax I am currently heavily invested in a project and so cannot take up this task at the moment. Meanwhile, a PR is welcome as always.

puranjayjain avatar Jul 11 '17 13:07 puranjayjain

this bug still occurs in version 2.3.0

dinhducit avatar Dec 05 '18 04:12 dinhducit

your can dirty fix it by prevent mouseevents on disabled next or prev buttons

#mddtp-date__left:disabled,#mddtp-date__right:disabled{ pointer-events: none; }

vwfox avatar Aug 28 '19 12:08 vwfox