Skip to content

Commit

Permalink
Remove presumptuous auto-scroll feature when adding groups. Closes CM…
Browse files Browse the repository at this point in the history
  • Loading branch information
jtsternberg authored and devin committed Mar 3, 2015
1 parent d37687b commit 2b7adc6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
15 changes: 2 additions & 13 deletions js/cmb2.js
Original file line number Diff line number Diff line change
Expand Up @@ -409,18 +409,7 @@ window.CMB2 = (function(window, document, $, undefined){
return this;
};

cmb.afterRowInsert = function( $row, group ) {

var $focus = $row.find('input:not([type="button"]), textarea, select').first();
if ( $focus.length ) {
if ( group ) {
$('html, body').animate({
scrollTop: Math.round( $focus.offset().top - 150 )
}, 1000);
}
$focus.focus();
}

cmb.afterRowInsert = function( $row ) {
var _prop;

// Need to re-init wp_editor instances
Expand Down Expand Up @@ -504,7 +493,7 @@ window.CMB2 = (function(window, document, $, undefined){
var $newRow = $( '<div class="postbox cmb-row cmb-repeatable-grouping" data-iterator="'+ cmb.idNumber +'">'+ $row.html() +'</div>' );
$oldRow.after( $newRow );

cmb.afterRowInsert( $newRow, true );
cmb.afterRowInsert( $newRow );

if ( $table.find('.cmb-repeatable-grouping').length <= 1 ) {
$table.find('.cmb-remove-group-row').prop( 'disabled', true );
Expand Down
Loading

1 comment on commit 2b7adc6

@DevinWalker
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this getting merged in anytime soon?

Please sign in to comment.