Kendo grid default menu filters scroll page to top on open

1 Answer 119 Views
Grid
VULSK
Top achievements
Rank 1
VULSK asked on 13 Dec 2021, 10:47 AM | edited on 13 Dec 2021, 10:48 AM

Hello,

when the default menu filter icons are clicked/filter popup is being opened, the page scrolls to the top. When I scroll down to the grid, I can see that the filter opened. Only happens with default filters. Tested with Chrome 96.0.4664.45 and Firefox 95.0.

I managed to replicate the unwanted behavior in StackBlitz:

https://stackblitz.com/edit/grid-in-cell-edit-with-datetimepicker-gljp2r?file=app/app.component.ts

The same thing happens if the top of the page is filled with other components, that have no relationship with the component containing the grid.

I have tried setting specific filter types, but it did not help. 

Is there a way to fix this?

1 Answer, 1 is accepted

Sort by
0
Yanmario
Telerik team
answered on 15 Dec 2021, 01:51 PM

Hi Vulsk,

Thank you for the provided example and feedback.

Indeed the described issue is known and logged in our public GitHub repository that includes some additional information:

https://github.com/telerik/kendo-angular/issues/3392

The issue is currently in our backlog, but I cannot provide any specific ETA on when it would be fixed at this current time.

As a workaround, the developer can attach a click event on the Grid filter buttons that will allow canceling the scroll of the page and re-enable the scroll back right after. Please check the following example demonstrating the mentioned approach:

https://stackblitz.com/edit/angular-ncdkt4-af8cta?file=app%2Fapp.component.ts

ngAfterViewInit() {
    let filterElement = document.querySelectorAll('.k-grid-filter');
    Array.from(filterElement).forEach((f) => {
      f.addEventListener(
        'click',
        () => {
          var x = window.scrollX;
          var y = window.scrollY;
          console.log('e');
          window.onscroll = () => {
            window.scrollTo(x, y);
          };

          setTimeout(() => {
            window.onscroll = () => {};
          });
        },
        true
      );
    });
  }

I hope the provided workaround helps and we apologize for any inconvenience caused until the issue is resolved.

Regards,
Yanmario
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Grid
Asked by
VULSK
Top achievements
Rank 1
Answers by
Yanmario
Telerik team
Share this question
or