Skip to content

Commit 736d4d6

Browse files
committed
Merge branch 'master' of https://github.com/IgniteUI/igniteui-angular into copilot/support-multiple-entry-points
2 parents ff4bf22 + c4d55ca commit 736d4d6

File tree

3 files changed

+29
-9
lines changed

3 files changed

+29
-9
lines changed

projects/igniteui-angular/core/src/services/overlay/overlay.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,12 +431,18 @@ export class IgxOverlayService implements OnDestroy {
431431
}
432432
}
433433
this.updateSize(info);
434+
const openAnimation = info.settings.positionStrategy.settings.openAnimation;
435+
const closeAnimation = info.settings.positionStrategy.settings.closeAnimation;
434436
info.settings.positionStrategy.position(
435437
info.elementRef.nativeElement.parentElement,
436438
{ width: info.initialSize.width, height: info.initialSize.height },
437439
this._document,
438440
true,
439441
info.settings.target);
442+
if (openAnimation !== info.settings.positionStrategy.settings.openAnimation ||
443+
closeAnimation !== info.settings.positionStrategy.settings.closeAnimation){
444+
this.buildAnimationPlayers(info);
445+
}
440446
this.addModalClasses(info);
441447
if (info.settings.positionStrategy.settings.openAnimation) {
442448
// TODO: should we build players again. This was already done in attach!!!

projects/igniteui-angular/directives/src/directives/toggle/toggle.directive.ts

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@ import {
33
Directive,
44
ElementRef,
55
EventEmitter,
6-
HostBinding,
76
HostListener,
87
Inject,
98
Input,
109
OnDestroy,
1110
OnInit,
1211
Optional,
13-
Output
12+
Output,
1413
} from '@angular/core';
1514
import { AbsoluteScrollStrategy } from 'igniteui-angular/core';
1615
import { CancelableBrowserEventArgs, IBaseEventArgs, PlatformUtil } from 'igniteui-angular/core';
@@ -38,7 +37,13 @@ export interface ToggleViewCancelableEventArgs extends ToggleViewEventArgs, Canc
3837
@Directive({
3938
exportAs: 'toggle',
4039
selector: '[igxToggle]',
41-
standalone: true
40+
standalone: true,
41+
host: {
42+
'[class.igx-toggle--hidden]': 'hiddenClass',
43+
'[attr.aria-hidden]': 'hiddenClass',
44+
'[class.igx-toggle--hidden-webkit]': 'hiddenWebkitClass',
45+
'[class.igx-toggle]': 'defaultClass'
46+
}
4247
})
4348
export class IgxToggleDirective implements IToggleView, OnInit, OnDestroy {
4449
/**
@@ -163,13 +168,13 @@ export class IgxToggleDirective implements IToggleView, OnInit, OnDestroy {
163168
/**
164169
* @hidden
165170
*/
166-
@HostBinding('class.igx-toggle--hidden')
167-
@HostBinding('attr.aria-hidden')
168171
public get hiddenClass() {
169172
return this.collapsed;
170173
}
171174

172-
@HostBinding('class.igx-toggle--hidden-webkit')
175+
/**
176+
* @hidden
177+
*/
173178
public get hiddenWebkitClass() {
174179
const isSafari = this.platform?.isSafari;
175180
const browserVersion = this.platform?.browserVersion;
@@ -180,7 +185,6 @@ export class IgxToggleDirective implements IToggleView, OnInit, OnDestroy {
180185
/**
181186
* @hidden
182187
*/
183-
@HostBinding('class.igx-toggle')
184188
public get defaultClass() {
185189
return !this.collapsed;
186190
}
@@ -228,6 +232,16 @@ export class IgxToggleDirective implements IToggleView, OnInit, OnDestroy {
228232
}
229233

230234
this._collapsed = false;
235+
236+
// TODO: this is a workaround for the issue introduced by Angular's with Ivy renderer.
237+
// When calling detectChanges(), Angular marks the element for check, but does not update the classes
238+
// immediately, which causes the overlay to calculate incorrect dimensions of target element.
239+
// Overlay show should be called in the next tick to ensure the classes are updated and target element is measured correctly.
240+
// Note: across the codebase, each host binding should be checked and similar fix applied if needed!!!
241+
this.elementRef.nativeElement.className = this.elementRef.nativeElement.className.replace('igx-toggle--hidden', 'igx-toggle');
242+
this.elementRef.nativeElement.className = this.elementRef.nativeElement.className.replace('igx-toggle--hidden-webkit', 'igx-toggle');
243+
this.elementRef.nativeElement.removeAttribute('aria-hidden');
244+
231245
this.cdr.detectChanges();
232246

233247
if (!info) {

projects/igniteui-angular/grids/src/grids/toolbar/grid-toolbar.base.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { ColumnDisplayOrder } from '../common/enums';
66
import { IColumnToggledEventArgs } from '../common/events';
77
import { IgxColumnActionsComponent } from '../column-actions/column-actions.component';
88
import { IgxToolbarToken } from './token';
9-
import { AbsoluteScrollStrategy, ConnectedPositioningStrategy, HorizontalAlignment, OverlaySettings, VerticalAlignment } from 'igniteui-angular/core';
9+
import { AbsoluteScrollStrategy, AutoPositionStrategy, HorizontalAlignment, OverlaySettings, VerticalAlignment } from 'igniteui-angular/core';
1010
import { IgxToggleDirective, ToggleViewCancelableEventArgs, ToggleViewEventArgs } from 'igniteui-angular/directives';
1111

1212
/* blazorInclude */
@@ -86,7 +86,7 @@ export abstract class BaseToolbarDirective implements OnDestroy {
8686
private $sub: Subscription;
8787

8888
private _overlaySettings: OverlaySettings = {
89-
positionStrategy: new ConnectedPositioningStrategy({
89+
positionStrategy: new AutoPositionStrategy({
9090
horizontalDirection: HorizontalAlignment.Left,
9191
horizontalStartPoint: HorizontalAlignment.Right,
9292
verticalDirection: VerticalAlignment.Bottom,

0 commit comments

Comments
 (0)