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

Unified Diff: ui/webui/resources/js/cr/ui/focus_row.js

Issue 685783003: history: fix more focus oddness. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more fixes Created 6 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 side-by-side diff with in-line comments
Download patch
Index: ui/webui/resources/js/cr/ui/focus_row.js
diff --git a/ui/webui/resources/js/cr/ui/focus_row.js b/ui/webui/resources/js/cr/ui/focus_row.js
index b989f538f80d338d267082661389e03217fed0cd..0b982f42f1a5722f4bd5b19042fb9813a12fde6e 100644
--- a/ui/webui/resources/js/cr/ui/focus_row.js
+++ b/ui/webui/resources/js/cr/ui/focus_row.js
@@ -56,7 +56,7 @@ cr.define('cr.ui', function() {
if (item != document.activeElement)
item.tabIndex = -1;
- this.eventTracker_.add(item, 'click', this.onClick_.bind(this));
+ this.eventTracker_.add(item, 'mousedown', this.onMousedown_.bind(this));
}, this);
/**
@@ -76,8 +76,16 @@ cr.define('cr.ui', function() {
* |e|'s default is prevented, further processing is skipped.
* @param {cr.ui.FocusRow} row The row that detected a keydown.
* @param {Event} e The keydown event.
+ * @return {boolean} Whether the event was handled.
*/
onKeydown: assertNotReached,
+
+ /**
+ * @param {cr.ui.FocusRow} row The row that detected the mouse going down.
+ * @param {Event} e The mousedown event.
+ * @return {boolean} Whether the event was handled.
+ */
+ onMousedown: assertNotReached,
};
/** @interface */
@@ -157,10 +165,7 @@ cr.define('cr.ui', function() {
if (item < 0)
return;
- if (this.delegate_)
- this.delegate_.onKeydown(this, e);
-
- if (e.defaultPrevented)
+ if (this.delegate_ && this.delegate_.onKeydown(this, e))
return;
var index = -1;
@@ -185,7 +190,10 @@ cr.define('cr.ui', function() {
* @param {Event} e A click event.
* @private
*/
- onClick_: function(e) {
+ onMousedown_: function(e) {
+ if (this.delegate_ && this.delegate_.onMousedown(this, e))
+ return;
+
if (!e.button)
this.activeIndex = this.items.indexOf(e.currentTarget);
},
« chrome/test/data/webui/history_browsertest.js ('K') | « ui/webui/resources/js/cr/ui/focus_grid.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698