| 56 | // A collapsed caret parked mid-string would scramble the order of the digits |
| 57 | // after it; a deliberate range selection (select-all, drag) stays native. |
| 58 | const keepCaretAtEnd = (e: SyntheticEvent<HTMLInputElement>) => { |
| 59 | const input = e.currentTarget; |
| 60 | const end = input.value.length; |
| 61 | |
| 62 | if (input.selectionStart !== input.selectionEnd) { |
| 63 | return; |
| 64 | } |
| 65 | |
| 66 | if (input.selectionStart === end) { |
| 67 | return; |
| 68 | } |
| 69 | |
| 70 | input.setSelectionRange(end, end); |
| 71 | }; |
| 72 | |
| 73 | return ( |
| 74 | <div className="relative flex flex-row gap-2"> |