Skip to content

Commit

Permalink
fix(autoclose): browser detection for SSR (#3027)
Browse files Browse the repository at this point in the history
Fixes #3025
  • Loading branch information
maxokorokov committed Feb 19, 2019
1 parent 967e949 commit 5536368
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/util/autoclose.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ const isHTMLElementContainedIn = (element: HTMLElement, array?: HTMLElement[]) =

// we'll have to use 'touch' events instead of 'mouse' events on iOS and add a more significant delay
// to avoid re-opening when handling (click) on a toggling element
const iOS = !!navigator.userAgent && /iPad|iPhone|iPod/.test(navigator.userAgent);
// TODO: use proper Angular platform detection when NgbAutoClose becomes a service and we can inject PLATFORM_ID
let iOS = false;
if (typeof navigator !== 'undefined') {
iOS = !!navigator.userAgent && /iPad|iPhone|iPod/.test(navigator.userAgent);
}

export function ngbAutoClose(
zone: NgZone, document: any, type: boolean | 'inside' | 'outside', close: () => void, closed$: Observable<any>,
Expand Down

0 comments on commit 5536368

Please sign in to comment.