whatwg / html

HTML Standard
https://html.spec.whatwg.org/multipage/
Other
8.09k stars 2.66k forks source link

Allow controlling autofocus behavior #2698

Open jimmywarting opened 7 years ago

jimmywarting commented 7 years ago

I was annoyed by how chrome puts the cursor at the beginning of this input element

<input type="url" value="http://" autofocus>

Safari and Firefox did select the hole text which i found to be more useful

I think it could be useful if you could set a behavior with the attribute rather then it being a boolean attribute

annevk commented 7 years ago

We generally don't define UI behavior. Apple in particular is usually pretty vocal about wanting to match platform conventions over everything else. You could try to convince Chrome though to change their behavior.

domenic commented 4 years ago

I think this might be an observable interop issue. See https://boom-bath.glitch.me/autofocus-range.html which prints selectionStart and selectionEnd after autofocus.

It seems this is just a Safari bug, as far as I can tell.