Skip to content

Commit

Permalink
[datetime] Fix DateInput IE11 bug when changing month/day (#3471)
Browse files Browse the repository at this point in the history
  • Loading branch information
gjvoosten authored and adidahiya committed Apr 9, 2019
1 parent 44043fd commit 5a6ccb2
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/datetime/src/dateInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,16 @@ export class DateInput extends AbstractPureComponent<IDateInputProps, IDateInput

// focus DOM event listener (not React event)
private handlePopoverBlur = (e: FocusEvent) => {
const relatedTarget = e.relatedTarget as HTMLElement;
if (relatedTarget == null || !this.popoverContentEl.contains(relatedTarget)) {
let relatedTarget = e.relatedTarget as HTMLElement;
if (relatedTarget == null) {
// Support IE11 (#2924)
relatedTarget = document.activeElement as HTMLElement;
}
// Beware: this.popoverContentEl is sometimes null under Chrome
if (
relatedTarget == null ||
(this.popoverContentEl != null && !this.popoverContentEl.contains(relatedTarget))
) {
this.handleClosePopover();
} else if (relatedTarget != null) {
this.unregisterPopoverBlurHandler();
Expand Down

1 comment on commit 5a6ccb2

@blueprint-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[datetime] Fix DateInput IE11 bug when changing month/day (#3471)

Previews: documentation | landing | table

Please sign in to comment.