From 321feb0056cbeaefd853236f1d76e6c5600f15be Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Wed, 3 Feb 2016 14:43:08 +0100 Subject: [PATCH] fix(autocomplete): fix autocomplete tabindex support - We should always apply to the root directive a tabindex of `-1` - We should direct the tabindex to the input (if tabindex is specified) - Added accompanying tests Fixes #6999. Closes #7005 # Conflicts: # src/components/autocomplete/autocomplete.spec.js --- src/components/autocomplete/js/autocompleteDirective.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/autocomplete/js/autocompleteDirective.js b/src/components/autocomplete/js/autocompleteDirective.js index e83180d9a33..a9e027f0a8d 100644 --- a/src/components/autocomplete/js/autocompleteDirective.js +++ b/src/components/autocomplete/js/autocompleteDirective.js @@ -163,7 +163,9 @@ function MdAutocomplete () { // removing the element is hidden while retrieving the template. For example when using ngIf. if (noItemsTemplate) element.attr('md-has-not-found', true); - if (!attr.hasOwnProperty('tabindex')) element.attr('tabindex', '-1'); + // Always set our tabindex of the autocomplete directive to -1, because our input + // will hold the actual tabindex. + element.attr('tabindex', '-1'); return '\