| author | Andy Clement | 2012-01-27 17:36:32 (EST) |
|---|---|---|
| committer | John Arthorne | 2012-01-27 17:42:06 (EST) |
| commit | a0706ccbe801638427790394c8668433a8b4cffb (patch) (side-by-side diff) | |
| tree | f0b0b675f348070b4ce1e2f3d06d4c6df6a8b2b7 | |
| parent | e98fced7ca46a1844363348cb843a352edef1f6a (diff) | |
| download | org.eclipse.orion.client-a0706ccbe801638427790394c8668433a8b4cffb.zip org.eclipse.orion.client-a0706ccbe801638427790394c8668433a8b4cffb.tar.gz org.eclipse.orion.client-a0706ccbe801638427790394c8668433a8b4cffb.tar.bz2 | |
cursor key navigation through search results
| -rw-r--r-- | bundles/org.eclipse.orion.client.core/web/orion/widgets/OpenResourceDialog.js | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/bundles/org.eclipse.orion.client.core/web/orion/widgets/OpenResourceDialog.js b/bundles/org.eclipse.orion.client.core/web/orion/widgets/OpenResourceDialog.js index 7e6861b..85d20f3 100644 --- a/bundles/org.eclipse.orion.client.core/web/orion/widgets/OpenResourceDialog.js +++ b/bundles/org.eclipse.orion.client.core/web/orion/widgets/OpenResourceDialog.js @@ -78,6 +78,32 @@ var OpenResourceDialog = dojo.declare("orion.widgets.OpenResourceDialog", [dijit } } }); + dojo.connect(this,"onKeyPress",this,function(evt) { + var links, currentFocus, currentSelectionIndex; + if (evt.keyCode === dojo.keys.DOWN_ARROW && this.results) { + links = dojo.query("a", this.results); + currentFocus = dijit.getFocus(); + currentSelectionIndex = links.indexOf(currentFocus.node); + if (currentSelectionIndex === -1) { + dijit.focus(links[0]); + } else if (currentSelectionIndex<links.length) { + dijit.focus(links[currentSelectionIndex+1]); + } + dojo.stopEvent(evt); + } else if (evt.keyCode === dojo.keys.UP_ARROW) { + links = dojo.query("a", this.results); + currentFocus = dijit.getFocus(); + currentSelectionIndex = links.indexOf(currentFocus.node); + if (currentSelectionIndex < 1) { + // jump to input element + var text = this.resourceName && this.resourceName.get("textbox"); + dijit.focus(text); + } else if (currentSelectionIndex > 0) { + dijit.focus(links[currentSelectionIndex-1]); + } + dojo.stopEvent(evt); + } + }); dojo.connect(this, "onMouseUp", function(e) { // WebKit focuses <body> after link is clicked; override that e.target.focus(); @@ -216,4 +242,4 @@ var OpenResourceDialog = dojo.declare("orion.widgets.OpenResourceDialog", [dijit }); return OpenResourceDialog; -}); +});
\ No newline at end of file |

