New Story Autofocus
New story modal now autofocuses on the title when it appears. This required a small modification to the focus directive, as with DOM manipulation like modals, the popup elements are linked _before_ they are added to the DOM, rather than after. Adding a minor timeout fixed that. Change-Id: I5cb0001c2afd991544bc40c33c3fcd6b89f8b208
This commit is contained in:
parent
003c41fdc6
commit
1b354dd206
@ -15,6 +15,7 @@
|
||||
|
||||
<div class="col-sm-10">
|
||||
<input id="name"
|
||||
focus
|
||||
type="text"
|
||||
class="form-control"
|
||||
ng-model="story.title"
|
||||
|
@ -20,7 +20,7 @@
|
||||
* phase is run)
|
||||
*/
|
||||
angular.module('sb.util').directive('focus',
|
||||
function () {
|
||||
function ($timeout) {
|
||||
'use strict';
|
||||
|
||||
return {
|
||||
@ -29,8 +29,10 @@ angular.module('sb.util').directive('focus',
|
||||
// Extract the element...
|
||||
var e = $element[0];
|
||||
|
||||
if (!!e && e.hasOwnProperty('focus')) {
|
||||
e.focus();
|
||||
if (!!e && !!e.focus) {
|
||||
$timeout(function () {
|
||||
e.focus();
|
||||
}, 10);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user