Chrome built-in collector for input type = "time" input chokes after changing the min / max attribute

I found a rather annoying error in the built-in Chrome select timer related to updating the min / max <input type="time"> attribute to change , which I need.

When the field contains a valid time, the change event is fired every time a key is pressed and changes the min / max attribute. So, if I try to enter a double digit in hours or minutes, Chrome will do funny things after the first keystroke. Let's say I have 01:00 PM in the field and I focus on 00 and try to introduce different things:

  input value transitions ------- -------------------------------------------- 1 1 : 01:00 PM => 01:01 PM => 01:01 PM 1 0 : 01:00 PM => 01:01 PM => 01:00 PM 1 1 1 : 01:00 PM => 01:01 PM => 01:01 PM => 01:11 PM 

For me, this seems like a bug in Chrome, but at the same time I need some workaround (except disabling the built-in collector), and I have no ideas. I was able to isolate the problem so you can see it here:

https://jsfiddle.net/omegak/snoykv1j/

+5
source share
1 answer

We can solve the problem by setting the max attribute only if you need to change the maximum value.

 if ($(e.target).attr('max')) $(e.target).attr('max', ''); 
0
source

All Articles