| 326 | |
| 327 | @Listen('click', { capture: true }) |
| 328 | onBackdropClick(ev: any) { |
| 329 | // TODO(FW-2832): type (CustomEvent triggers errors which should be sorted) |
| 330 | if (this._isOpen && this.lastOnEnd < ev.timeStamp - 100) { |
| 331 | const shouldClose = ev.composedPath ? !ev.composedPath().includes(this.menuInnerEl) : false; |
| 332 | |
| 333 | if (shouldClose) { |
| 334 | ev.preventDefault(); |
| 335 | ev.stopPropagation(); |
| 336 | this.close(undefined, BACKDROP); |
| 337 | } |
| 338 | } |
| 339 | } |
| 340 | |
| 341 | onKeydown(ev: KeyboardEvent) { |
| 342 | if (ev.key === 'Escape') { |