oferh / ng2-completer

Angular 2 autocomplete component
http://oferh.github.io/ng2-completer/
MIT License
347 stars 172 forks source link

Dropdown usability improvement - Open, close and select all text by click #260

Closed marciomsm closed 7 years ago

marciomsm commented 7 years ago

@oferh I needed to implement an improvement to suit my project, if you think it's a good change, you could merge it.

I implemented a property openOnClick as default value false. When this property is true, the dropdown open and close by click. The all text also is selected when you click on the field.

In this case, it is not necessary to implement the extra code below:

<div class="col-1 p-0">
    <div class="w-25 chevron-holder" [ngClass]="{'dropdown-open': openCloseFocused}">
        <span class="chevron fa" [ngClass]="{'fa-chevron-down': !isOpen, 'fa-chevron-up': isOpen}" (click)="onToggle()"></span>
    </div>
</div>

I hope to help to improve your fantastic component.

Thanks.

oferh commented 7 years ago

Hi @marciomsm Thanks for the PR! Can't openOnFocus be used to get the same effect as openOnClick?

marciomsm commented 7 years ago

Hi @oferh...so I needed to open the dropdown all times that I click. When we already are focused on the field and click on it, the dropdown doesn't open again. I also need to select the whole text when I click on it. If you have any chance to test these changes, let me know what do you think. I did these changes because in my project the client complained about the usability. Before do these changes I was using openOnFocus. Thanks.

oferh commented 7 years ago

merged to dev