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

Unified Diff: chrome/browser/resources/file_manager/js/file_manager.js

Issue 13779006: Fixed gear menu navigation using keyboard. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 8 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
Index: chrome/browser/resources/file_manager/js/file_manager.js
diff --git a/chrome/browser/resources/file_manager/js/file_manager.js b/chrome/browser/resources/file_manager/js/file_manager.js
index 4d735c5fd8d42ee67e6ccf7ca3d5ab1851c69e17..903fa756790a3230ce534d8cdc23cbc92ec3ac98 100644
--- a/chrome/browser/resources/file_manager/js/file_manager.js
+++ b/chrome/browser/resources/file_manager/js/file_manager.js
@@ -547,6 +547,9 @@ DialogType.isModal = function(type) {
false /* Without loading caption. */));
cr.ui.decorate(this.gearButton_, cr.ui.MenuButton);
+ this.gearMenu_ = this.dialogDom_.querySelector('#gear-menu');
+ this.gearMenu_.menuItemSelector = 'menuitem, hr';
+
this.syncButton.checkable = true;
this.hostedButton.checkable = true;
};
@@ -2034,8 +2037,31 @@ DialogType.isModal = function(type) {
* @private
*/
FileManager.prototype.updateGearMenu_ = function() {
mtomasz 2013/04/08 09:59:39 This seems to be correct, but I think we can make
hirono 2013/04/09 04:05:48 I fixed the code so that the menu items are hidden
- this.syncButton.hidden = !this.isOnDrive();
- this.hostedButton.hidden = !this.isOnDrive();
+ // Show or hide optional items.
+ var ctrlMenuHidden = !this.dialogDom_.hasAttribute('ctrl-pressing');
+ var menuItems = this.gearMenu_.menuItems;
+ var length = menuItems.length;
+ for (var i = 0; i < length; i++) {
+ var hidden = null;
+ var item = menuItems[i];
+ if (item.getAttribute('required_attr') == 'ctrl-pressing') {
+ if (hidden !== true) {
+ hidden = ctrlMenuHidden;
+ }
+ }
+ if (item.hasAttribute('required_drive')) {
+ if (hidden !== true) {
+ hidden = !this.isOnDrive();
+ }
+ }
+ if (hidden !== null) {
+ if (hidden) {
+ item.setAttribute('hidden', '');
+ } else {
+ item.removeAttribute('hidden');
+ }
+ }
+ }
// If volume has changed, then fetch remaining space data.
if (this.previousRootUrl_ != this.directoryModel_.getCurrentRootUrl())
@@ -2517,6 +2543,7 @@ DialogType.isModal = function(type) {
switch (util.getKeyModifiers(event) + event.keyCode) {
case 'Ctrl-17': // Ctrl => Show hidden setting
this.dialogDom_.setAttribute('ctrl-pressing', 'true');
+ this.updateGearMenu_();
return;
case 'Ctrl-190': // Ctrl-. => Toggle filter files.
@@ -2562,6 +2589,7 @@ DialogType.isModal = function(type) {
switch (util.getKeyModifiers(event) + event.keyCode) {
case '17': // Ctrl => Hide hidden setting
this.dialogDom_.removeAttribute('ctrl-pressing');
+ this.updateGearMenu_();
return;
}
};

Powered by Google App Engine
This is Rietveld 408576698