Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
fix(autocomplete): adds tabindex support for autocomplete
Browse files Browse the repository at this point in the history
Closes #2113
  • Loading branch information
Robert Messerle committed Oct 9, 2015
1 parent de32e5b commit b4e6354
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/components/autocomplete/js/autocompleteDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,17 @@ function MdAutocomplete () {
template: function (element, attr) {
var noItemsTemplate = getNoItemsTemplate(),
itemTemplate = getItemTemplate(),
leftover = element.html();
leftover = element.html(),
tabindex = attr.tabindex;

if (noItemsTemplate) {
hasNotFoundTemplate = true;
}

if (attr.hasOwnProperty('tabindex')) {
element.attr('tabindex', '-1');
}

return '\
<md-autocomplete-wrap\
layout="row"\
Expand Down Expand Up @@ -216,6 +221,7 @@ function MdAutocomplete () {
<md-input-container flex ng-if="floatingLabel">\
<label>{{floatingLabel}}</label>\
<input type="search"\
' + (tabindex != null ? 'tabindex="' + tabindex + '"' : '') + '\
id="{{ inputId || \'fl-input-\' + $mdAutocompleteCtrl.id }}"\
name="{{inputName}}"\
autocomplete="off"\
Expand All @@ -238,6 +244,7 @@ function MdAutocomplete () {
} else {
return '\
<input flex type="search"\
' + (tabindex != null ? 'tabindex="' + tabindex + '"' : '') + '\
id="{{ inputId || \'input-\' + $mdAutocompleteCtrl.id }}"\
name="{{inputName}}"\
ng-if="!floatingLabel"\
Expand Down

0 comments on commit b4e6354

Please sign in to comment.