| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 UI.Dialog = class extends UI.GlassPane { | 31 UI.Dialog = class extends UI.GlassPane { |
| 32 constructor() { | 32 constructor() { |
| 33 super(); | 33 super(); |
| 34 this.registerRequiredCSS('ui/dialog.css'); | 34 this.registerRequiredCSS('ui/dialog.css'); |
| 35 this.contentElement.tabIndex = 0; | 35 this.contentElement.tabIndex = 0; |
| 36 this.contentElement.addEventListener('focus', () => this.widget().focus(), f
alse); | 36 this.contentElement.addEventListener('focus', () => this.widget().focus(), f
alse); |
| 37 this.contentElement.addEventListener('keydown', this._onKeyDown.bind(this),
false); | 37 this.contentElement.addEventListener('keydown', this._onKeyDown.bind(this),
false); |
| 38 this.setBlockPointerEvents(true); | |
| 39 this.setSetOutsideClickCallback(event => { | 38 this.setSetOutsideClickCallback(event => { |
| 40 this.hide(); | 39 this.hide(); |
| 41 event.consume(true); | 40 event.consume(true); |
| 42 }); | 41 }); |
| 43 /** @type {!Map<!HTMLElement, number>} */ | 42 /** @type {!Map<!HTMLElement, number>} */ |
| 44 this._tabIndexMap = new Map(); | 43 this._tabIndexMap = new Map(); |
| 45 /** @type {?UI.WidgetFocusRestorer} */ | 44 /** @type {?UI.WidgetFocusRestorer} */ |
| 46 this._focusRestorer = null; | 45 this._focusRestorer = null; |
| 47 } | 46 } |
| 48 | 47 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 /** | 109 /** |
| 111 * @param {!Event} event | 110 * @param {!Event} event |
| 112 */ | 111 */ |
| 113 _onKeyDown(event) { | 112 _onKeyDown(event) { |
| 114 if (event.keyCode === UI.KeyboardShortcut.Keys.Esc.code) { | 113 if (event.keyCode === UI.KeyboardShortcut.Keys.Esc.code) { |
| 115 event.consume(true); | 114 event.consume(true); |
| 116 this.hide(); | 115 this.hide(); |
| 117 } | 116 } |
| 118 } | 117 } |
| 119 }; | 118 }; |
| OLD | NEW |