Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow controlling autofocus behavior #2698

jimmywarting opened this issue May 19, 2017 · 2 comments

Allow controlling autofocus behavior #2698

jimmywarting opened this issue May 19, 2017 · 2 comments


Copy link

@jimmywarting jimmywarting commented May 19, 2017

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

  • autofocus="end" puts the cursor at the end
  • autofocus="start" puts the cursor in the beginning
  • autofocus="mark" highlight/marks the value for easy copy/cut/replace/navigate with arrow keys
  • autofocus default behavior

This comment has been minimized.

Copy link

@annevk annevk commented May 19, 2017

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.

@annevk annevk added the topic: focus label May 19, 2017
@domenic domenic changed the title define autofocus behavior Allow controlling autofocus behavior May 20, 2019

This comment has been minimized.

Copy link

@domenic domenic commented Nov 11, 2019

I think this might be an observable interop issue. See which prints selectionStart and selectionEnd after autofocus.

  • Firefox Windows: (0, 0)
  • Chrome Windows: (0, 0)
  • Chrome Mac: (0, 0)
  • Safari Mac: (0, 7)
  • Firefox Mac: (0, 0)

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.