Skip to content

Commit

Permalink
fix(chips): close manually autocomplete menu on mousedown (#784)
Browse files Browse the repository at this point in the history
since we are stopping the propagation of the click event for chips, this causes some issues with autocomplete since its listening to it
  • Loading branch information
emoralesb05 authored Jul 25, 2017
1 parent 7f2815d commit 08937b5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/platform/core/chips/chips.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ export class TdChipsComponent extends _TdChipsMixinBase implements ControlValueA
*/
private _watchOutsideClick(): void {
if (this._document) {
this._outsideClickSubs = RxChain.from(fromEvent(this._document, 'click')).call(filter, (event: MouseEvent) => {
this._outsideClickSubs = RxChain.from(fromEvent(this._document, 'mousedown')).call(filter, (event: MouseEvent) => {
const clickTarget: HTMLElement = <HTMLElement>event.target;
setTimeout(() => {
this._internalClick = false;
Expand All @@ -724,6 +724,7 @@ export class TdChipsComponent extends _TdChipsMixinBase implements ControlValueA
!this._elementRef.nativeElement.contains(clickTarget) && !this._internalClick;
}).subscribe(() => {
if (this.focused) {
this._autocompleteTrigger.closePanel();
this.removeFocusedState();
this.onTouched();
this._changeDetectorRef.markForCheck();
Expand Down

0 comments on commit 08937b5

Please sign in to comment.