Page MenuHomePhabricator

Add jQuery.hotkeys plugin for hooking keyboard events
Closed, DeclinedPublic

Description

Hi!

Could you add this plugin to /resources/jquery, so that it can be used as a module? E.g.:

mw.loader.using( 'jquery.hotkeys', function() {

// Some code...

} );


Version: unspecified
Severity: enhancement
URL: https://github.com/jeresig/jquery.hotkeys

Details

Reference
bz27493

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:23 PM
bzimport set Reference to bz27493.

Does anyone knows if there is any reason to not add this plugin?

For one, we need to decide which one to use.

The one linked in the bug is a fork of jeresig[1], but that is a 3-year old fork of a repository where he made 2 commits to fix a jquery 1.4.2 bug.

We probably want to use the original instead which has been maintained throughout the years and was last updated 3 months ago for jQuery 1.7.1.

And the original includes John Resig's changes (https://github.com/tzuryby/jquery.hotkeys/commit/2bc49e96bfed711244ceb0fc64b28f2c5b49900c)

[1] https://github.com/jeresig/jquery.hotkeys/commits
[2] https://github.com/tzuryby/jquery.hotkeys/commits

Though there's a change in tzuryby's version. It uses namespaces to pass on which key to listen for. So instead of:
$(el).on( 'keypress', 'esc', fn );
or:
$(el).on( 'keypress', { key: 'esc' }, fn );

it now uses:
$(el).on( 'keypress.esc', fn );

That seems rather cripple in my opinion, not sure why anyone would want that or why they changed it.

[Removing "easy" keyword as the solution is not clear - see comment 3]

Lacking use case and immediate product need. Seems mostly obsoleted by OOUI.