From 11b24f7e435875885080e8ba2467620b4fe7c58d Mon Sep 17 00:00:00 2001 From: Joao Mesquita Date: Mon, 24 Aug 2015 10:18:25 -0300 Subject: [PATCH] FS-8026 [Verto-Communicator] #resolve Add an autofocus directive to both dialpad and login so that enter will just work. On dialpad useful to provide keyboard only input without the need to using the mouse. --- .../verto/verto_communicator/js/directives.js | 22 +++++++++++++++++++ .../verto_communicator/partials/dialpad.html | 2 +- .../verto_communicator/partials/login.html | 2 +- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/html5/verto/verto_communicator/js/directives.js b/html5/verto/verto_communicator/js/directives.js index 5b809f6ea6..9514d754f0 100644 --- a/html5/verto/verto_communicator/js/directives.js +++ b/html5/verto/verto_communicator/js/directives.js @@ -85,3 +85,25 @@ vertoDirectives.directive('showControls', link: link }; }); + +/* +Sometimes autofocus HTML5 directive just isn't enough with SPAs. +This directive will force autofocus to work properly under those circumstances. +*/ +(function () { + 'use strict'; + + vertoDirectives.directive('autofocus', ['$timeout', + function ($timeout) { + return { + restrict: 'A', + link: function ($scope, $element) { + $timeout(function () { + console.log('Focusing...'); + $element[0].focus(); + }); + } + }; + } + ]); +})(); \ No newline at end of file diff --git a/html5/verto/verto_communicator/partials/dialpad.html b/html5/verto/verto_communicator/partials/dialpad.html index 3addb72c23..a6348bf3bc 100644 --- a/html5/verto/verto_communicator/partials/dialpad.html +++ b/html5/verto/verto_communicator/partials/dialpad.html @@ -41,7 +41,7 @@ - + diff --git a/html5/verto/verto_communicator/partials/login.html b/html5/verto/verto_communicator/partials/login.html index 47cfae4791..9df7ba184b 100644 --- a/html5/verto/verto_communicator/partials/login.html +++ b/html5/verto/verto_communicator/partials/login.html @@ -11,7 +11,7 @@
- +