Skip to content

Commit

Permalink
Fix TypeError when event.target is HTMLDocument (OfficeDev#316)
Browse files Browse the repository at this point in the history
  • Loading branch information
torlye authored and Jahnp committed Jul 31, 2017
1 parent f9071b9 commit 34192bf
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/components/ContextualMenu/ContextualMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@ namespace fabric {
}

private _onDocumentClick(event: Event): void {
const target: HTMLElement = <HTMLElement>event.target;
const classList: DOMTokenList = target.classList;
if (!this._hostTarget.contains(target) && !classList.contains("ms-ContextualMenu-link")) {
this._isOpen = false;
if (event.target instanceof HTMLElement) {
const target: HTMLElement = <HTMLElement>event.target;
const classList: DOMTokenList = target.classList;
if (!this._hostTarget.contains(target) && !classList.contains("ms-ContextualMenu-link")) {
this._isOpen = false;
}
}
}

Expand Down

0 comments on commit 34192bf

Please sign in to comment.