From f53db0f2e24c5de67bc43566e1103cf7d53edf80 Mon Sep 17 00:00:00 2001 From: Laurence Tennant Date: Wed, 14 Dec 2016 02:51:19 +0000 Subject: [PATCH] Better autofocus (#1664) --- .../articles/client/views/admin/form-article.client.view.html | 2 +- modules/core/client/directives/auto-focus.client.directive.js | 4 +++- modules/users/client/views/admin/edit-user.client.view.html | 2 +- .../client/views/password/forgot-password.client.view.html | 2 +- .../client/views/password/reset-password.client.view.html | 2 +- .../client/views/settings/change-password.client.view.html | 2 +- 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/modules/articles/client/views/admin/form-article.client.view.html b/modules/articles/client/views/admin/form-article.client.view.html index 15f05dbee8..ead0d67304 100644 --- a/modules/articles/client/views/admin/form-article.client.view.html +++ b/modules/articles/client/views/admin/form-article.client.view.html @@ -12,7 +12,7 @@

{{vm.article._id ? 'Edit Article' : 'New Article'}}

- +

Article title is required.

diff --git a/modules/core/client/directives/auto-focus.client.directive.js b/modules/core/client/directives/auto-focus.client.directive.js index 0cebc7ddba..a8307fcbcc 100644 --- a/modules/core/client/directives/auto-focus.client.directive.js +++ b/modules/core/client/directives/auto-focus.client.directive.js @@ -20,7 +20,9 @@ function link(scope, element, attrs) { if ($window.innerWidth >= 800) { $timeout(function() { - element[0].focus(); + var el = element[0]; + el.focus(); + el.selectionStart = el.selectionEnd = el.value.length; }, 100); } } diff --git a/modules/users/client/views/admin/edit-user.client.view.html b/modules/users/client/views/admin/edit-user.client.view.html index 3687a28095..b029246c11 100644 --- a/modules/users/client/views/admin/edit-user.client.view.html +++ b/modules/users/client/views/admin/edit-user.client.view.html @@ -7,7 +7,7 @@

User

- +

First name is required.

diff --git a/modules/users/client/views/password/forgot-password.client.view.html b/modules/users/client/views/password/forgot-password.client.view.html index b549ee70a6..47a6fa83a1 100644 --- a/modules/users/client/views/password/forgot-password.client.view.html +++ b/modules/users/client/views/password/forgot-password.client.view.html @@ -5,7 +5,7 @@

Restore your password

- +

Enter a username.

diff --git a/modules/users/client/views/password/reset-password.client.view.html b/modules/users/client/views/password/reset-password.client.view.html index be7f4e7cc8..7ce662ccbb 100644 --- a/modules/users/client/views/password/reset-password.client.view.html +++ b/modules/users/client/views/password/reset-password.client.view.html @@ -5,7 +5,7 @@

Reset your password

- +

Enter a new password.

diff --git a/modules/users/client/views/settings/change-password.client.view.html b/modules/users/client/views/settings/change-password.client.view.html index f01dfd5aed..8d99f6b935 100644 --- a/modules/users/client/views/settings/change-password.client.view.html +++ b/modules/users/client/views/settings/change-password.client.view.html @@ -4,7 +4,7 @@
- +

Your current password is required.