Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions projects/igniteui-angular/src/lib/directives/button/button-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
Output,
booleanAttribute,
inject,
afterRenderEffect,
AfterViewInit,
} from '@angular/core';
import { PlatformUtil } from '../../core/utils';

Expand All @@ -20,8 +20,9 @@ export const IgxBaseButtonType = {


@Directive()
export abstract class IgxButtonBaseDirective {
export abstract class IgxButtonBaseDirective implements AfterViewInit{
private _platformUtil = inject(PlatformUtil);
private _viewInit = false;

/**
* Emitted when the button is clicked.
Expand Down Expand Up @@ -101,15 +102,16 @@ export abstract class IgxButtonBaseDirective {
// In SSR there is no paint, so there’s no visual rendering or transitions to suppress.
// Fix style flickering https://github.com/IgniteUI/igniteui-angular/issues/14759
if (this._platformUtil.isBrowser) {
afterRenderEffect({
write: () => {
this.element.nativeElement.style.setProperty('--_init-transition', '0s');
},
read: () => {
requestAnimationFrame(() => {
this.element.nativeElement.style.removeProperty('--_init-transition');
});
}
this.element.nativeElement.style.setProperty('--_init-transition', '0s');
}
}

public ngAfterViewInit(): void {
if (this._platformUtil.isBrowser && !this._viewInit) {
this._viewInit = true;

requestAnimationFrame(() => {
this.element.nativeElement.style.removeProperty('--_init-transition');
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6580,27 +6580,24 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {

// Scroll the search list to the bottom.
let scrollbar = GridFunctions.getExcelStyleSearchComponentScrollbar(fix);
expect(scrollbar.scrollTop).toBe(0);
let listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix);
expect(listItems[0].innerText).toBe('Select All');

scrollbar.scrollTop = 3000;
await wait();
fix.detectChanges();
expect(listItems[0].innerText).not.toBe('Select All');
expect(scrollbar.scrollTop).toBeGreaterThan(300);

// Select another column
GridFunctions.clickExcelFilterIcon(fix, 'Downloads');
await wait();
fix.detectChanges();

// Update scrollbar
const searchComponent = GridFunctions.getExcelStyleSearchComponent(fix);
scrollbar = GridFunctions.getExcelStyleSearchComponentScrollbar(fix);
await wait();
fix.detectChanges();

// Get the display container and its parent and verify that the display container is at start
const displayContainer = searchComponent.querySelector('igx-display-container');
const displayContainerRect = displayContainer.getBoundingClientRect();
const parentContainerRect = displayContainer.parentElement.getBoundingClientRect();

expect(displayContainerRect.top - parentContainerRect.top <= 1).toBe(true, 'search scrollbar did not reset');
expect(scrollbar.scrollTop).toBe(0, 'search scrollbar did not reset');
});
});

Expand Down
Loading