Backspace in input type="number" behaves badly in Blink

while entering a number ex. 12,345,678 and after that when i do backspace then blink is behaving badly. Suppose if i delete 4 then my blink goes to the end it does not remain on same line.

I am using value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");

I expect that blink should remain on the same line from where i have deleted the number.

Hello Samir.

That is a javascript issue, not related with OS.

You must save cursor position to place it where it was before the replacement.

Example: https://stackoverflow.com/questions/8219639/stop-cursor-from-jumping-to-end-of-input-field-in-javascript-replace