autofocus not parsing attribute #1951
Description
The issues forum is NOT for support requests. It is for bugs and feature requests only.
Please read https://github.com/angular-ui/ui-select/blob/master/CONTRIBUTING.md and search
existing issues (both open and closed) prior to opening any new issue and ensure you follow the instructions therein.
Bug description:
autofocus only checks for the existence of the attribute, not the value of the attribute. i.e. these all produce the same result... autofocus=""
or autofocus="true"
or autofocus="false"
I am using formly to generate the ui-select fields and each field gets the autofocus attribute, some blank, one true.
current code is
if (angular.isDefined(attrs.autofocus)){
$timeout(function(){
$select.setFocus();
});
}
I think the below is what code should be, not sure if it would be a breaking change.
if (angular.isDefined(attrs.autofocus) && $parse(attrs.autofocus)()){
$timeout(function(){
$select.setFocus();
});
}
Version of Angular, UI-Select, and Bootstrap/Select2/Selectize CSS
Angular: 1,5.8
UI-Select: 0.19.5
Bootstrap/Select2/Selectize CSS (if applicable): 3.2