Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 cr.define('ntp', function() { | 5 cr.define('ntp', function() { |
| 6 'use strict'; | 6 'use strict'; |
| 7 | 7 |
| 8 // We can't pass the currently dragging tile via dataTransfer because of | 8 // We can't pass the currently dragging tile via dataTransfer because of |
| 9 // http://crbug.com/31037 | 9 // http://crbug.com/31037 |
| 10 var currentlyDraggingTile = null; | 10 var currentlyDraggingTile = null; |
| (...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 696 * @private | 696 * @private |
| 697 */ | 697 */ |
| 698 handleMouseDown_: function(e) { | 698 handleMouseDown_: function(e) { |
| 699 var focusable = findAncestorByClass(/** @type {Element} */(e.target), | 699 var focusable = findAncestorByClass(/** @type {Element} */(e.target), |
| 700 'focusable'); | 700 'focusable'); |
| 701 if (focusable) { | 701 if (focusable) { |
| 702 this.focusElementIndex_ = | 702 this.focusElementIndex_ = |
| 703 Array.prototype.indexOf.call(this.focusableElements_, | 703 Array.prototype.indexOf.call(this.focusableElements_, |
| 704 focusable); | 704 focusable); |
| 705 this.updateFocusElement_(); | 705 this.updateFocusElement_(); |
| 706 } else { | |
| 707 // This prevents the tile page from getting focus when the user clicks | |
| 708 // inside the grid but outside of any tile. | |
|
Evan Stade
2015/11/09 23:29:32
does this still work? where does focus go if you c
karandeepb
2015/11/10 14:23:20
On clicking between the tiles now, the focus reach
Evan Stade
2015/11/11 01:14:57
honestly, that bug is not worth fixing, but I can'
| |
| 709 e.preventDefault(); | |
| 710 } | 706 } |
| 711 }, | 707 }, |
| 712 | 708 |
| 713 /** | 709 /** |
| 714 * Handle arrow key focus nav. | 710 * Handle arrow key focus nav. |
| 715 * @param {Event} e The focus event. | 711 * @param {Event} e The focus event. |
| 716 * @private | 712 * @private |
| 717 */ | 713 */ |
| 718 handleKeyDown_: function(e) { | 714 handleKeyDown_: function(e) { |
| 719 // We only handle up, down, left, right without control keys. | 715 // We only handle up, down, left, right without control keys. |
| 720 if (e.metaKey || e.shiftKey || e.altKey || e.ctrlKey) | 716 if (e.metaKey || e.shiftKey || e.altKey || e.ctrlKey) |
| 721 return; | 717 return; |
| (...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1378 }; | 1374 }; |
| 1379 | 1375 |
| 1380 return { | 1376 return { |
| 1381 getCurrentlyDraggingTile: getCurrentlyDraggingTile, | 1377 getCurrentlyDraggingTile: getCurrentlyDraggingTile, |
| 1382 setCurrentDropEffect: setCurrentDropEffect, | 1378 setCurrentDropEffect: setCurrentDropEffect, |
| 1383 // Not used outside, just for usage in JSDoc inside this file. | 1379 // Not used outside, just for usage in JSDoc inside this file. |
| 1384 Tile: Tile, | 1380 Tile: Tile, |
| 1385 TilePage: TilePage, | 1381 TilePage: TilePage, |
| 1386 }; | 1382 }; |
| 1387 }); | 1383 }); |
| OLD | NEW |