You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When update dataSource ( push new item to list ) mat-select scrollTop = 0;
When debugger check problem in here:
/** * Scrolls the currently active option into the view if it is not yet visible. */privateadjustScrollTopToFitActiveOptionIntoView(): void{if(this.matSelect.panel&&this.matSelect.options.length>0){constmatOptionHeight=this.getMatOptionHeight();constactiveOptionIndex=this.matSelect._keyManager.activeItemIndex||0;constlabelCount=_countGroupLabelsBeforeOption(activeOptionIndex,this.matSelect.options,this.matSelect.optionGroups);// If the component is in a MatOption, the activeItemIndex will be offset by one.constindexOfOptionToFitIntoView=(this.matOption ? -1 : 0)+labelCount+activeOptionIndex;constcurrentScrollTop=this.matSelect.panel.nativeElement.scrollTop;constsearchInputHeight=this.innerSelectSearch.nativeElement.offsetHeightconstamountOfVisibleOptions=Math.floor((SELECT_PANEL_MAX_HEIGHT-searchInputHeight)/matOptionHeight);constindexOfFirstVisibleOption=Math.round((currentScrollTop+searchInputHeight)/matOptionHeight)-1;if(indexOfFirstVisibleOption>=indexOfOptionToFitIntoView){==>>bugindexOfOptionToFitIntoView=0this.matSelect.panel.nativeElement.scrollTop=indexOfOptionToFitIntoView*matOptionHeight;}elseif(indexOfFirstVisibleOption+amountOfVisibleOptions<=indexOfOptionToFitIntoView){this.matSelect.panel.nativeElement.scrollTop=(indexOfOptionToFitIntoView+1)*matOptionHeight-(SELECT_PANEL_MAX_HEIGHT-searchInputHeight);}}}
issue in conditional : if (indexOfFirstVisibleOption >= indexOfOptionToFitIntoView) To Reproduce
Describe the bug
When update dataSource ( push new item to list ) mat-select scrollTop = 0;
When debugger check problem in here:
issue in conditional :
if (indexOfFirstVisibleOption >= indexOfOptionToFitIntoView)
To Reproduce
Important Please provide a reproduction example. You can use https://stackblitz.com/github/bithost-gmbh/ngx-mat-select-search-example as a starting point
Expected behavior
Screenshots
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: