(follow-up r80554) If person typed max amount in edit summary, backspace didn't work...
authorBrian Wolff <bawolff@users.mediawiki.org>
Wed, 2 Mar 2011 03:57:58 +0000 (03:57 +0000)
committerBrian Wolff <bawolff@users.mediawiki.org>
Wed, 2 Mar 2011 03:57:58 +0000 (03:57 +0000)
This still doesn't recognize all special keys on affected versions of opera as
keystrokes to ignore. I don't think this is a big issue, since backspace
is recognized (which is the only key thats really important), newer
versions of Opera should not be affected, and (based on a skim of the jQuery
site) it appears that if we ever upgrade our version of jQuery, the issue
might go away. (not 100% sure about that last part)

Originally when i was testing this code, I tested in all sorts of browsers
that it would stop people from putting more text in. I never tested that
it would allow backspaces (I now have, opera was the only affected one where
it didn't work).

Thanks to Alex Smotrov for reporting issue.

resources/mediawiki.action/mediawiki.action.edit.js

index e5b5095..8a785e6 100644 (file)
                // JQuery should also normalize e.which to be consistent cross-browser,
                // however the same check is still needed regardless of jQuery.
 
-               if ( e.which === 0 || e.charCode === 0 || e.ctrlKey || e.altKey || e.metaKey ) {
+               // Note: At the moment, for some older opera versions (~< 10.5)
+               // some special keys won't be recognized (aka left arrow key).
+               // Backspace will be, so not big issue.
+
+               if ( e.which === 0 || e.charCode === 0 || e.which === 8 ||
+                       e.ctrlKey || e.altKey || e.metaKey )
+               {
                        return true; //a special key (backspace, etc) so don't interfere.
                }