When clicking on an input with some text inside, normally the browser places the cursor/caret where you clicked within the text (beginning, end, in-between letters, etc). However, clicking the very top edge of the input always places the cursor at the beginning of the text, and clicking the bottom always places it at the end. I have to imagine this was intentional. It's consistent across all browsers. But it can easily be misleading/annoying when you go to click at the end of the text expecting to continue writing, but click just slightly too high and find the cursor at the start.
Video example: https://i.stack.imgur.com/VkNGA.jpg
I've seen plenty of answers addressing how to force the cursor to the end of the text in response to a focus event or some other trigger. However, I didn't find any that addressed only forcing the cursor to the end if that top edge is clicked. As far as I could tell there's no way to discern a top-edge click from a genuine click on the beginning of the text using either the click
or focus
events.
It'd also be great to know just out curiosity why this is the default behavior in the first place.