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

autofocus not parsing attribute #1951

Open
@brianchance

Description

@brianchance

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions