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

Unified Diff: ui/file_manager/file_manager/foreground/js/ui/location_line.js

Issue 947083002: [Files.app] Refine tabindexes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/file_manager/file_manager/foreground/js/ui/banners.js ('k') | ui/file_manager/file_manager/main.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/file_manager/foreground/js/ui/location_line.js
diff --git a/ui/file_manager/file_manager/foreground/js/ui/location_line.js b/ui/file_manager/file_manager/foreground/js/ui/location_line.js
index c0933f8c9edfcd0c9de822594cba16481a144432..564bc49ea617693a070291321db731208b6c7668 100644
--- a/ui/file_manager/file_manager/foreground/js/ui/location_line.js
+++ b/ui/file_manager/file_manager/foreground/js/ui/location_line.js
@@ -14,8 +14,6 @@ function LocationLine(breadcrumbs, volumeManager) {
this.breadcrumbs_ = breadcrumbs;
this.volumeManager_ = volumeManager;
this.entry_ = null;
-
- breadcrumbs.addEventListener('click', this.onClick_.bind(this));
}
/**
@@ -112,12 +110,19 @@ LocationLine.prototype.update_ = function(components) {
var div = doc.createElement('div');
div.classList.add('breadcrumb-path', 'entry-name');
div.textContent = component.name;
- div.pathComponent = component;
+ div.tabIndex = 8;
+ div.addEventListener('click', this.execute_.bind(this, div, component));
+ div.addEventListener('keydown', function(div, component, event) {
+ // If the pressed key is either Enter or Space.
+ if (event.keyCode == 13 || event.keyCode == 32)
+ this.execute_(div, component);
+ }.bind(this, div, component));
this.breadcrumbs_.appendChild(div);
// If this is the last component, break here.
if (i === components.length - 1) {
div.classList.add('breadcrumb-last');
+ div.tabIndex = -1;
break;
}
@@ -225,16 +230,18 @@ LocationLine.prototype.hide = function() {
};
/**
- * Handle a click event on a breadcrumb element.
- * @param {!Event} event The click event.
+ * Execute an element.
+ * @param {!Element} element Element to be executed.
+ * @param {!LocationLine.PathComponent} pathComponent Path Component object of
+ * the element.
* @private
*/
-LocationLine.prototype.onClick_ = function(event) {
- if (!event.target.classList.contains('breadcrumb-path') ||
- event.target.classList.contains('breadcrumb-last'))
+LocationLine.prototype.execute_ = function(element, pathComponent) {
+ if (!element.classList.contains('breadcrumb-path') ||
+ element.classList.contains('breadcrumb-last'))
return;
- event.target.pathComponent.resolveEntry().then(function(entry) {
+ pathComponent.resolveEntry().then(function(entry) {
var pathClickEvent = new Event('pathclick');
pathClickEvent.entry = entry;
this.dispatchEvent(pathClickEvent);
« no previous file with comments | « ui/file_manager/file_manager/foreground/js/ui/banners.js ('k') | ui/file_manager/file_manager/main.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698