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

Side by Side Diff: chrome/browser/resources/settings/search_engines_page/search_engine_entry.js

Issue 2700863002: MD Settings: adjust focus-outline behaviors on search engine iron-list. (Closed)
Patch Set: Created 3 years, 10 months 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 | « chrome/browser/resources/settings/search_engines_page/search_engine_entry.html ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 /** 5 /**
6 * @fileoverview 'settings-search-engine-entry' is a component for showing a 6 * @fileoverview 'settings-search-engine-entry' is a component for showing a
7 * search engine with its name, domain and query URL. 7 * search engine with its name, domain and query URL.
8 */ 8 */
9 Polymer({ 9 Polymer({
10 is: 'settings-search-engine-entry', 10 is: 'settings-search-engine-entry',
(...skipping 15 matching lines...) Expand all
26 type: Boolean, 26 type: Boolean,
27 computed: 'computeShowDots_(engine.canBeDefault,' + 27 computed: 'computeShowDots_(engine.canBeDefault,' +
28 'engine.canBeEdited,' + 28 'engine.canBeEdited,' +
29 'engine.canBeRemoved)', 29 'engine.canBeRemoved)',
30 }, 30 },
31 31
32 /** @private {boolean} */ 32 /** @private {boolean} */
33 showEditSearchEngineDialog_: Boolean, 33 showEditSearchEngineDialog_: Boolean,
34 }, 34 },
35 35
36 /** @private {!boolean} */
37 focusedByKey_: false,
38
36 /** @private {settings.SearchEnginesBrowserProxy} */ 39 /** @private {settings.SearchEnginesBrowserProxy} */
37 browserProxy_: null, 40 browserProxy_: null,
38 41
42 attached: function() {
43 // Flag that `this` is focused by keyboard, so mouse click doesn't apply
44 // the .no-outline class.
45 this.addEventListener('keyup', function(e) {
hcarmona 2017/02/16 22:33:06 can we use listeners instead? listeners: { 'key
Dan Beam 2017/02/16 22:52:48 +1
scottchen 2017/02/16 23:01:53 Acknowledged, will try that on the new behavior I
46 // If focusing on icon, then it doesn't count as the row being focused.
47 if(!this.$$('paper-icon-button').focused)
48 this.focusedByKey_ = true;
49 }.bind(this));
50
51 // Unflag when moving away via keyboard (e.g. tabbing onto its children).
52 this.addEventListener('keydown', function(e) {
53 this.focusedByKey_ = false;
54 }.bind(this));
55
56 // When clicking on a row, do not show focus outline if the element wasn't
57 // already in focus.
58 this.addEventListener('mousedown', function(e){
59 if(!this.focusedByKey_)
hcarmona 2017/02/16 22:33:06 What are you trying to prevent here? Is this to ma
Dan Beam 2017/02/16 22:52:48 see: action_link.js
scottchen 2017/02/16 23:01:54 Yeah hcarmona@ it's to prevent exactly that. dbeam
60 this.classList.add('no-outline');
61 }.bind(this));
62
63 // Reset when moving away from the row entirely.
64 this.addEventListener('blur', function() {
65 this.classList.remove('no-outline');
66 this.focusedByKey_ = false;
67 }.bind(this));
68 },
69
39 /** @override */ 70 /** @override */
40 created: function() { 71 created: function() {
41 this.browserProxy_ = settings.SearchEnginesBrowserProxyImpl.getInstance(); 72 this.browserProxy_ = settings.SearchEnginesBrowserProxyImpl.getInstance();
42 }, 73 },
43 74
44 /** @private */ 75 /** @private */
45 closePopupMenu_: function() { 76 closePopupMenu_: function() {
46 this.$$('dialog[is=cr-action-menu]').close(); 77 this.$$('dialog[is=cr-action-menu]').close();
47 }, 78 },
48 79
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 }.bind(this)); 138 }.bind(this));
108 }.bind(this)); 139 }.bind(this));
109 }, 140 },
110 141
111 /** @private */ 142 /** @private */
112 onMakeDefaultTap_: function() { 143 onMakeDefaultTap_: function() {
113 this.closePopupMenu_(); 144 this.closePopupMenu_();
114 this.browserProxy_.setDefaultSearchEngine(this.engine.modelIndex); 145 this.browserProxy_.setDefaultSearchEngine(this.engine.modelIndex);
115 }, 146 },
116 }); 147 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/settings/search_engines_page/search_engine_entry.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698