Fix keyboard navigation for diff browser
authorBjörn Steinbrink <steinbrink@saltation.de>
Tue, 26 Apr 2011 08:44:09 +0000 (10:44 +0200)
committerBjörn Steinbrink <steinbrink@saltation.de>
Tue, 26 Apr 2011 08:58:18 +0000 (10:58 +0200)
commitc1e52fba9e7c88f1146bb6df1f8b58dff006f45e
treeb83c8d31dd7addd2d07d54a0e9596f39b59537e0
parentca5914c8015b4a615549cfb06b0d8efb8f4056f9
Fix keyboard navigation for diff browser

The callback that handles keypresses to implement keyboard navigation
for the diff browser tried to unbind the callbacks whenever an input
field received or lost input. There were two problems with that.

First, the handler for the blur event didn't call the "enable" method,
so the state of the _enable flag wasn't updated and things became
inconsistent.

Second, bind/unbind were called with dynamically generated functions, so
the unbind wouldn't work, because you actually tried to unbind a
different function than the one you originally bound.

Instead of all that bind/unbind magic, the code now binds once, and then
toggles a simple flag to enable/disable that is checked by a guard
clause in the keypress handler.

Signed-off-by: Björn Steinbrink <steinbrink@saltation.de>
public/javascripts/gitorious/diff_browser.js