From: Jakob Kramer Date: Sat, 24 Mar 2012 13:49:43 +0000 (+0100) Subject: Allow arrow keys in input fields and textareas X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=e8be1d7af550267ab8e5e4cd3aad7a2e28e65ce3;p=mediagoblin.git Allow arrow keys in input fields and textareas If you pressed an arrow key in a textarea before, the next/previous media was opened. --- diff --git a/mediagoblin/static/css/base.css b/mediagoblin/static/css/base.css index 0a0d0dcd..909c9790 100644 --- a/mediagoblin/static/css/base.css +++ b/mediagoblin/static/css/base.css @@ -29,7 +29,7 @@ body { background-color: #111; background-image: url("../images/background.png"); color: #C3C3C3; - padding: none; + padding: 0; margin: 0px; height: 100%; font: 16px 'Lato', 'Helvetica Neue', Arial, 'Liberation Sans', FreeSans, sans-serif; diff --git a/mediagoblin/static/js/keyboard_navigation.js b/mediagoblin/static/js/keyboard_navigation.js index d4039a3c..7401e4d8 100644 --- a/mediagoblin/static/js/keyboard_navigation.js +++ b/mediagoblin/static/js/keyboard_navigation.js @@ -16,6 +16,15 @@ * along with this program. If not, see . */ +/* It must be wrapped into a function and you also cannot use + * $(':not(textarea, input)') because of some reason. */ + +$(document).ready(function(){ + $('textarea, input').keydown(function(event){ + event.stopPropagation(); + }); +}); + $(document).keydown(function(event){ switch(event.which){ case 37: @@ -30,4 +39,3 @@ $(document).keydown(function(event){ break; } }); -