Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(160)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/ui/SwatchPopoverHelper.js

Issue 2510883002: DevTools: all swatches should have a default focused element (Closed)
Patch Set: ac Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/ui/Popover.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 /** 4 /**
5 * @unrestricted 5 * @unrestricted
6 */ 6 */
7 UI.SwatchPopoverHelper = class extends Common.Object { 7 UI.SwatchPopoverHelper = class extends Common.Object {
8 constructor() { 8 constructor() {
9 super(); 9 super();
10 this._popover = new UI.Popover(); 10 this._popover = new UI.Popover();
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 // Reopen the picker for another anchor element. 47 // Reopen the picker for another anchor element.
48 this.hide(true); 48 this.hide(true);
49 } 49 }
50 50
51 delete this._isHidden; 51 delete this._isHidden;
52 this._anchorElement = anchorElement; 52 this._anchorElement = anchorElement;
53 this._view = view; 53 this._view = view;
54 this._hiddenCallback = hiddenCallback; 54 this._hiddenCallback = hiddenCallback;
55 this.reposition(); 55 this.reposition();
56 view.focus();
56 57
57 var document = this._popover.element.ownerDocument; 58 var document = this._popover.element.ownerDocument;
58 document.addEventListener('mousedown', this._hideProxy, false); 59 document.addEventListener('mousedown', this._hideProxy, false);
59 document.defaultView.addEventListener('resize', this._hideProxy, false); 60 document.defaultView.addEventListener('resize', this._hideProxy, false);
60 this._view.contentElement.addEventListener('keydown', this._boundOnKeyDown, false); 61 this._view.contentElement.addEventListener('keydown', this._boundOnKeyDown, false);
61 } 62 }
62 63
63 reposition() { 64 reposition() {
64 // Unbind "blur" listener to avoid reenterability: |popover.showView| will h ide the popover and trigger it synchronously. 65 // Unbind "blur" listener to avoid reenterability: |popover.showView| will h ide the popover and trigger it synchronously.
65 this._view.contentElement.removeEventListener('focusout', this._boundFocusOu t, false); 66 this._view.contentElement.removeEventListener('focusout', this._boundFocusOu t, false);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 this.hide(true); 104 this.hide(true);
104 event.consume(true); 105 event.consume(true);
105 return; 106 return;
106 } 107 }
107 if (event.key === 'Escape') { 108 if (event.key === 'Escape') {
108 this.hide(false); 109 this.hide(false);
109 event.consume(true); 110 event.consume(true);
110 } 111 }
111 } 112 }
112 }; 113 };
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/ui/Popover.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698