Skip to content

Commit

Permalink
fix(picklist): update scroll parameters on reorder (#17565)
Browse files Browse the repository at this point in the history
  • Loading branch information
afermon authored Feb 14, 2025
1 parent 7da117b commit a3ff0c1
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/primeng/src/picklist/picklist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1100,13 +1100,16 @@ export class PickList extends BaseComponent implements AfterViewChecked, AfterCo

ngAfterViewChecked() {
if (this.movedUp || this.movedDown) {
let listItems = find(this.reorderedListElement, 'li.p-highlight');
let listItems = find(this.reorderedListElement?.el.nativeElement, 'li.p-listbox-option-selected');

let listItem;

if (this.movedUp) listItem = listItems[0];
else listItem = listItems[listItems.length - 1];
if (listItems.length > 0) {
if (this.movedUp) listItem = listItems[0];
else listItem = listItems[listItems.length - 1];

scrollInView(this.reorderedListElement, listItem);
scrollInView(this.reorderedListElement?.el.nativeElement, listItem);
}
this.movedUp = false;
this.movedDown = false;
this.reorderedListElement = null;
Expand Down

0 comments on commit a3ff0c1

Please sign in to comment.