Skip to content
This repository was archived by the owner on Dec 16, 2022. It is now read-only.

Commit 8651519

Browse files
committed
Fix conflict issue when control order is changed
1 parent d9fae37 commit 8651519

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

js/customize-post-section.js

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,7 @@
892892
// Detect conflict errors.
893893
api.bind( 'error', function( response ) {
894894
var theirValue, ourValue,
895-
isFirstConflict = true;
895+
conflictedControls = [];
896896
if ( ! response.update_conflicted_setting_values ) {
897897
return;
898898
}
@@ -913,12 +913,22 @@
913913
} );
914914
control.notifications.remove( notification.code );
915915
control.notifications.add( notification.code, notification );
916-
}
917-
if ( api.section( control.section() ).expanded() && isFirstConflict ) {
918-
control.focus();
919-
isFirstConflict = false;
916+
conflictedControls.push( control );
920917
}
921918
} );
919+
920+
// Focus on first field that have conflict.
921+
if ( section.expanded() ) {
922+
_.every( section.controls(), function( _setting ) {
923+
return _.every( conflictedControls, function( conflictedControl ) {
924+
if ( conflictedControl.id === _setting.id ) {
925+
_setting.focus();
926+
return false;
927+
}
928+
return true;
929+
} );
930+
} );
931+
}
922932
} );
923933

924934
api.bind( 'save', function() {

0 commit comments

Comments
 (0)