-
Notifications
You must be signed in to change notification settings - Fork 3.4k
fix(autocomplete): always set tabindex to allow receiving focus. #6135
fix(autocomplete): always set tabindex to allow receiving focus. #6135
Conversation
if (attr.hasOwnProperty('tabindex')) { | ||
element.attr('tabindex', '-1'); | ||
} | ||
element.attr('tabindex', '-1'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like someone originally went to do the right thing and forgot a !
. It should be:
if (!attrs['tabindex']) {
$element.attr('tabindex', '-1');
}
94ebebb
to
f8fcbb2
Compare
@@ -98,6 +98,31 @@ describe('<md-autocomplete>', function() { | |||
element.remove(); | |||
})); | |||
|
|||
it('should allow receiving focus on the autocomplete', function() { | |||
var scope = createScope(null, {inputId: 'custom-input-id'}); | |||
var template = '\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer string concatenation instead of using \
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm just trying my best in using the best code conventions. The tests above also use \
.
But I will use string concatenation, because you wish that 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah- typically good, but I've been hoping to eliminate the \
stuff over time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, I will remember that
f8fcbb2
to
825cd9c
Compare
Used your suggestions now @jelbourn |
At the moment we only set the
tabindex
if we specify atabindex
attribute.That's why the autocomplete won't receive focus on
sidenav
autofocus.Closes #6101 Fixes #5665
Please review @jelbourn