File tree Expand file tree Collapse file tree
packages/@lightningjs/ui-components/src/components/ControlRow Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -122,7 +122,7 @@ export default class ControlRow extends TitleRow {
122122 _appendItemsAt ( items , appendIndex , removeSpacingIndex ) {
123123 const itemsCopy = [ ...items ] ;
124124
125- if ( removeSpacingIndex != undefined ) {
125+ if ( removeSpacingIndex != undefined && removeSpacingIndex >= 0 ) {
126126 this . items [ removeSpacingIndex ] . extraItemSpacing = undefined ;
127127 itemsCopy [ itemsCopy . length - 1 ] . extraItemSpacing =
128128 this . extraItemSpacing == undefined
@@ -133,6 +133,7 @@ export default class ControlRow extends TitleRow {
133133 }
134134
135135 addContentItems ( items ) {
136+ const lastSelected = this . selectedIndex ;
136137 const itemsToAdd = this . _createContentItems ( items ) ;
137138 const addIndex = this . _lastItemIndex + 1 ;
138139 this . _appendItemsAt ( itemsToAdd , addIndex , this . _lastItemIndex ) ;
@@ -142,6 +143,9 @@ export default class ControlRow extends TitleRow {
142143 this . _contentItems = [ ...this . contentItems , ...itemsToAdd ] ;
143144 }
144145
146+ this . _updateContent ( ) ;
147+ this . selectedIndex = lastSelected ;
148+
145149 this . patch ( {
146150 stopLazyScrollIndex : this . leftControls . length + this . items . length - 1
147151 } ) ;
You can’t perform that action at this time.
0 commit comments