mirror of
https://github.com/richard-loafle/fuse-angular.git
synced 2025-01-09 20:15:07 +00:00
(FusePerfectScrollbar) Unbind 'keydown' events of the PerfectScrollbar instances. This fixes the Angular Material inputs' high CPU usage.. The real problem is in the Angular Material library but we cannot do anything about it so we have removed the keyboard events of the PerfectScrollbar which resolves this years long issue.
This commit is contained in:
parent
cbd1c3e21c
commit
4da339cef1
|
@ -15,7 +15,7 @@ export class FusePerfectScrollbarDirective implements AfterViewInit, OnDestroy
|
|||
{
|
||||
isInitialized: boolean;
|
||||
isMobile: boolean;
|
||||
ps: PerfectScrollbar;
|
||||
ps: PerfectScrollbar | any;
|
||||
|
||||
// Private
|
||||
private _enabled: boolean | '';
|
||||
|
@ -200,6 +200,19 @@ export class FusePerfectScrollbarDirective implements AfterViewInit, OnDestroy
|
|||
this.ps = new PerfectScrollbar(this.elementRef.nativeElement, {
|
||||
...this.fusePerfectScrollbarOptions
|
||||
});
|
||||
|
||||
// Unbind 'keydown' events of PerfectScrollbar since it causes an extremely
|
||||
// high CPU usage on Angular Material inputs.
|
||||
// Loop through all the event elements of this PerfectScrollbar instance
|
||||
this.ps.event.eventElements.forEach((eventElement) => {
|
||||
|
||||
// If we hit to the element with a 'keydown' event...
|
||||
if ( typeof eventElement.handlers['keydown'] !== 'undefined' )
|
||||
{
|
||||
// Unbind it
|
||||
eventElement.element.removeEventListener('keydown', eventElement.handlers['keydown'][0]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue
Block a user