Skip to content

Commit

Permalink
Bug 370229 - Command image buttons cannot be used via keyboard
Browse files Browse the repository at this point in the history
  • Loading branch information
Max Li committed Feb 7, 2012
1 parent d31e4e5 commit 0a3207a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions bundles/org.eclipse.orion.client.core/web/orion/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,9 @@ define(['require', 'dojo', 'dijit', 'orion/util', 'dijit/Menu', 'dijit/form/Drop
dojo.addClass(element, "commandMissingImageButton commandButton");
} else {
image = addImageToElement(this, element, name);
if(this.tooltip) {
dojo.attr(element, "aria-label", this.tooltip);
}
}
dojo.connect(element, "onclick", this, function() {
// collect parameters in advance if specified
Expand All @@ -950,6 +953,17 @@ define(['require', 'dojo', 'dijit', 'orion/util', 'dijit/Menu', 'dijit/form/Drop
this.callback.call(context.handler, context);
}
});
// onClick events do not register with keyboard for spans
dojo.connect(element, "onkeypress", this, function(e) {
if(e.keyCode === dojo.keys.ENTER || e.keyCode === dojo.keys.SPACE) {
// collect parameters in advance if specified
if (this.parameters && context.collectsParameters()) {
context.commandService._collectParameters("tool", context);
} else if (this.callback) {
this.callback.call(context.handler, context);
}
}
});
var overClass = image ? "commandImageOver" : "commandButtonOver";
this._setupActivateVisuals(element, element, activeCommandClass, inactiveCommandClass, overClass);

Expand Down

0 comments on commit 0a3207a

Please sign in to comment.