Skip to content

Commit

Permalink
Fixed #2513
Browse files Browse the repository at this point in the history
  • Loading branch information
Çağatay Çivici committed Apr 13, 2017
1 parent 1c88bb3 commit 88245ef
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions components/dropdown/dropdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const DROPDOWN_VALUE_ACCESSOR: any = {
template: `
<div #container [ngClass]="{'ui-dropdown ui-widget ui-state-default ui-corner-all ui-helper-clearfix':true,
'ui-state-disabled':disabled,'ui-dropdown-open':panelVisible,'ui-state-focus':focus}"
(click)="onMouseclick($event,in)" [ngStyle]="style" [class]="styleClass">
(click)="onMouseclick($event)" [ngStyle]="style" [class]="styleClass">
<div class="ui-helper-hidden-accessible" *ngIf="autoWidth">
<select [required]="required" tabindex="-1">
<option *ngFor="let option of options" [value]="option.value" [selected]="selectedOption == option">{{option.label}}</option>
Expand Down Expand Up @@ -118,6 +118,8 @@ export class Dropdown implements OnInit,AfterViewInit,AfterContentInit,AfterView

@ViewChild('filter') filterViewChild: ElementRef;

@ViewChild('in') focusViewChild: ElementRef;

@ContentChildren(PrimeTemplate) templates: QueryList<any>;

public itemTemplate: TemplateRef<any>;
Expand Down Expand Up @@ -222,6 +224,7 @@ export class Dropdown implements OnInit,AfterViewInit,AfterContentInit,AfterView
onItemClick(event, option) {
this.itemClick = true;
this.selectItem(event, option);
this.focusViewChild.nativeElement.focus();

this.hide();
}
Expand Down Expand Up @@ -304,15 +307,15 @@ export class Dropdown implements OnInit,AfterViewInit,AfterContentInit,AfterView
}
}

onMouseclick(event,input) {
onMouseclick(event) {
if(this.disabled||this.readonly) {
return;
}

this.selfClick = true;

if(!this.itemClick) {
input.focus();
this.focusViewChild.nativeElement.focus();

if(this.panelVisible)
this.hide();
Expand Down

0 comments on commit 88245ef

Please sign in to comment.