Skip to content
This repository has been archived by the owner on Oct 2, 2019. It is now read-only.

autofocus not parsing attribute #1951

Open
brianchance opened this issue Mar 28, 2017 · 2 comments
Open

autofocus not parsing attribute #1951

brianchance opened this issue Mar 28, 2017 · 2 comments

Comments

@brianchance
Copy link

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

@Jefiozie
Copy link
Contributor

Thanks for this will have a look at it.

@thomasdc
Copy link

What's the status of this issue? I very much would like to have this functionality as well. Now, it simply ignores the attribute value.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants