Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #331 from anchor/patch-1

Unbreak handling of Ctrl-RightArrow in the editor window
  • Loading branch information...
commit c21d7df70595983de40cb141e8e9c5ec5e15d632 2 parents 47097fa + 83e3c08
@saturnflyer saturnflyer authored
Showing with 7 additions and 1 deletion.
  1. +7 −1 public/javascripts/admin/shortcuts.js
View
8 public/javascripts/admin/shortcuts.js
@@ -3,8 +3,14 @@ var ShortcutKeysBehavior = Behavior.create({
var character = String.fromCharCode(event.keyCode);
if(!event.shiftKey && !character.blank())
character = character.toLowerCase();
+ // Blindly passing RIGHT_ARROW through fromCharCode() returns a single-quote character (ascii decimal 39).
+ // I suspect that causes a bad string interpolation when evaluating `button`.
+ // Adding double-quotes to the accesskey spec seems to fix it.
+ // Now of course now keyCode 34 (double-quote in ascii decimal) will cause a problem... but your browser will likely catch Ctrl+PgDn anyway
+ // We should only evaluate keyCodes that can come from printable characters, now sure how feasible that is.
+ // Eg. http://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes
if(event.ctrlKey && event.keyCode != 17){
- var button = $$('input[accesskey='+character+']')[0];
+ var button = $$('input[accesskey="'+character+'"]')[0];
if(button){
event.stop();
button.click();
Please sign in to comment.
Something went wrong with that request. Please try again.