Remove jQuery code that does nothing

This commit replaces a block of jQuery code that I believe does nothing. I found it while starting the work to make our JS code compatible with jQuery 3 as it uses jQuery.fn.keyup() which has been deprecated.

As far as I can understand, this block of code is supposed to change the focus to the coupon description when the user hits the tab key while the focus is on the title field. It doesn't work because the keyup event is not fired for the tab key. The current behavior is that when the user hits the tab key, the focus changes to the "Generate coupon code" button, and if the tab key is pressed another time, the focus changes to the description text field. Which seems fine to me and that is why I'm suggesting we remove this code instead of fixing it.

I believe it was added in this c15b8e817c commit six years ago and unfortunatelly the commit doesn't provide much information on why it was added.
This commit is contained in:
Rodrigo Primo 2020-11-14 15:25:34 -03:00
parent 581f57b8f4
commit 5c8491c862
1 changed files with 0 additions and 12 deletions

View File

@ -16,18 +16,6 @@ jQuery( function ( $ ) {
runTipTip();
// Allow Tabbing
$( '#titlediv' ).find( '#title' ).keyup( function( event ) {
var code = event.keyCode || event.which;
// Tab key
if ( code === '9' && $( '#woocommerce-coupon-description' ).length > 0 ) {
event.stopPropagation();
$( '#woocommerce-coupon-description' ).focus();
return false;
}
});
$( '.wc-metaboxes-wrapper' ).on( 'click', '.wc-metabox > h3', function() {
$( this ).parent( '.wc-metabox' ).toggleClass( 'closed' ).toggleClass( 'open' );
});