Shipping Settings: Highlight text on focus of cost input values (#42689)

This commit is contained in:
Paul Sealock 2023-12-20 08:22:17 +13:00 committed by GitHub
parent f83a2a8ae8
commit b04c45ee5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 2 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: update
Select text when focusing cost inputs on Shipping Settings modals.

View File

@ -4310,8 +4310,6 @@ table.wc_shipping {
}
&.wc-shipping-modal-price {
color: #757575;
&.wc-shipping-currency-position-left,
&.wc-shipping-currency-position-left_space {

View File

@ -345,6 +345,8 @@
}
});
shippingMethodView.highlightOnFocus( '.wc-shipping-modal-price' );
$( document.body ).trigger( 'init_tooltips' );
},
onConfigureShippingMethodSubmitted: function( event, target, posted_data ) {
@ -398,6 +400,12 @@
$( 'table.wc-shipping-zone-methods' ).before( error_html );
},
highlightOnFocus: function( query ) {
const inputs = $( query );
inputs.focus( function() {
$( this ).select();
} );
},
onAddShippingMethod: function( event ) {
event.preventDefault();
@ -585,6 +593,8 @@
status : 'new'
}
});
shippingMethodView.highlightOnFocus( '.wc-shipping-modal-price' );
} else {
shippingMethodView.model.trigger( 'change:methods' );
shippingMethodView.model.trigger( 'saved:methods' );