ngx-mat-select-search
ngx-mat-select-search copied to clipboard
[BUG] scrolling using Page Up and Home does not scroll all the way to the top
Describe the bug Using Home or Page Up to scroll does not seem to take into consideration the sticky element, so it will only scroll to the top of the actual list of options, which leaves the very first element of the list hidden under the search. Any ideas on how to get this fixed?
To Reproduce You can see it in the example provided.
thanks for reporting this issue. do you want to try to find a fix?
How about something like this?
`
_handleKeydown(event: KeyboardEvent) {
//existing code.
if (event.key === 'PageUp' || event.key === 'PageDown') {
const panel = this.matSelect.panel.nativeElement;
const left = panel.scrollLeft;
const top = panel.scrollTop;
const delta = panel.scrollHeight - 32 * 5;
event.key === 'PageUp' ? panel.scrollTo(left, top - delta) : panel.scrollTo(left, top + delta);
event.preventDefault();
}
if (event.key === 'Home' || event.key === 'End') {
const panel = this.matSelect.panel.nativeElement;
event.key === 'Home' ? panel.scrollTo(0, 0) : panel.scrollTo(0, panel.scrollHeight);
event.preventDefault();
}
} `
I havent tested that, but do you want to create a PR and test that this works properly?
@paulflo150 would you like to prepare a PR?