DatePicker require double click in IE11 to select date
http://plnkr.co/edit/HPqPaFGNvlDEnOykgGBT?p=preview
Current behavior Date picker require double click in IE11 to select date from date picker
Expected behavior Date picker require only once click in IE11 to select date from date picker
-
Angular version: 2.3.1
-
PrimeNG version: 2.0.0
-
Browser: IE 11
-
Language: TypeScript 2.0.3
-
Node (for AoT issues):
node --version= 4.4.3 -
** Windows 7
This is the same issue as #2026 and only affects calendar in IE11 when placeholder is applied. The underlying problem here is the way IE11 handles placeholder and field focus. When the focus is set/unset, the placeholder is removed/added which actually triggers onInput event (unlike other browsers).
p-calendar relies on this event and its actually blocking the other events so the date is not updated properly when selected in the datepicker for the first time.
There is no easy way of fixing that it seems (altho I think its fixed in Edge by Microsoft...). I have tried changing the 'onInput' binding to either one keypress/keyup/keydown and it seems to work for all browsers, although again in IE11 when you focus on the field initially to open datepicker, the placeholder will be removed and then when you select the date, the input loses focus and set the placeholder value back for split second before replacing that with the actual date value, so you end up with placeholder "flickering" for a moment.
Hi
This workaround works form me. I added a directive:
`import { Directive, ContentChild, AfterContentInit } from '@angular/core'; import { Calendar } from 'primeng/primeng';
@Directive({ selector: 'p-calendar' }) export class CalendarOnFocusDirective implements AfterContentInit {
@ContentChild(Calendar) calendar: Calendar;
constructor() { }
ngAfterContentInit() { this.calendar.onFocus.subscribe( ev => { ev.target.offsetParent.focus(); } ) } } `
@piowro That fixes an issue but have few side effects, the most major of which is the fact that you cant tab through calendar components in IE11 anymore.
Tracked at;
https://github.com/primefaces/primeng/issues/2026