Skip to content

Commit

Permalink
fix: stop opening pickers on input click (#3210)
Browse files Browse the repository at this point in the history
  • Loading branch information
JKMarkowski committed Sep 9, 2020
1 parent cd4932d commit 8e9cc0a
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 23 deletions.
1 change: 0 additions & 1 deletion libs/core/src/lib/date-picker/date-picker.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
[attr.aria-label]="dateInputLabel"
[(ngModel)]="inputFieldDate"
(ngModelChange)="handleInputChange($event)"
(click)="openCalendar()"
/>
<span fd-input-group-addon [button]="true" [compact]="compact">
<button
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<div class="fd-datetime">
<fd-popover
[(isOpen)]="isOpen"
[closeOnOutsideClick]="false"
[closeOnEscapeKey]="false"
[focusTrapped]="true"
[triggers]="[]"
[disabled]="disabled"
Expand All @@ -19,7 +17,6 @@
[(ngModel)]="inputFieldDate"
(ngModelChange)="handleInputChange($event)"
[placeholder]="placeholder"
(click)="openPopover()"
[compact]="compact"
[ngClass]="{ 'is-error': isInvalidDateInput && useValidation }"
[disabled]="disabled"
Expand Down
18 changes: 2 additions & 16 deletions libs/core/src/lib/datetime-picker/datetime-picker.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ import { DatePipe } from '@angular/common';
import { CalendarYearGrid, SpecialDayRule } from '../..';
import { PopoverComponent } from '../popover/popover.component';
import { PopoverBodyComponent } from '../popover/popover-body/popover-body.component';
import { Subject, Subscription } from 'rxjs';
import { delay, filter, first, takeUntil } from 'rxjs/operators';
import { Subject } from 'rxjs';
import { delay, first, takeUntil } from 'rxjs/operators';

/**
* The datetime picker component is an opinionated composition of the fd-popover,
Expand Down Expand Up @@ -370,20 +370,6 @@ export class DatetimePickerComponent implements OnInit, OnDestroy, ControlValueA
this.isInvalidDateInput = e;
}

/** @hidden */
@HostListener('document:keydown.escape', [])
onEscapeKeydownHandler(): void {
this.closePopover();
}

/** @hidden */
@HostListener('document:click', ['$event'])
public onGlobalClick(event: MouseEvent): void {
if (!this._elRef.nativeElement.contains(event.target) && !this.popoverBodyComponent.elRef.nativeElement.contains(event.target)) {
this.closePopover();
}
}

/** @hidden */
registerOnChange(fn: (selected: any) => { void }): void {
this.onChange = fn;
Expand Down
1 change: 0 additions & 1 deletion libs/core/src/lib/time-picker/time-picker.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
[placeholder]="placeholder"
[attr.aria-label]="timePickerInputLabel"
(keyup.enter)="timeInputChanged($event.currentTarget.value)"
(click)="inputGroupClicked($event)"
/>
</fd-input-group>
</fd-popover-control>
Expand Down
4 changes: 2 additions & 2 deletions libs/core/src/lib/time-picker/time-picker.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import { TimeFormatParser } from './format/time-parser';
import { FormStates } from '../form/form-control/form-states';
import { PopoverComponent } from '../popover/popover.component';
import { Placement } from 'popper.js';
import { Subject, Subscription } from 'rxjs';
import { delay, filter, first, takeUntil } from 'rxjs/operators';
import { Subject } from 'rxjs';
import { delay, first, takeUntil } from 'rxjs/operators';

@Component({
selector: 'fd-time-picker',
Expand Down

0 comments on commit 8e9cc0a

Please sign in to comment.