Skip to content
This repository has been archived by the owner on May 21, 2021. It is now read-only.

Commit

Permalink
fix(filter): fix getting focus after opening drop-down
Browse files Browse the repository at this point in the history
  • Loading branch information
Philipp Burgmer committed Jun 2, 2014
1 parent d48c1b4 commit a5c8967
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/w11k-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,21 +210,21 @@ angular.module('w11k.select').directive('w11kSelect', [
filterOptions();
}

if (scope.filter.active) {
// use timeout to open dropdown first and then set the focus,
// otherwise focus won't be set because element is not visible
$timeout(function () {
element[0].querySelector('.dropdown-menu input').focus();
});

}

$document.on('keyup', onEscPressed);

jqDropDownMenu.css('visibility', 'hidden');
$timeout(function () {
adjustHeight();
jqDropDownMenu.css('visibility', 'visible');

if (scope.filter.active) {
// use timeout to open dropdown first and then set the focus,
// otherwise focus won't be set because element is not visible
$timeout(function () {
element[0].querySelector('.dropdown-menu input').focus();
});
}
});
jqWindow.on('resize', adjustHeight);
},
Expand Down

0 comments on commit a5c8967

Please sign in to comment.