Skip to content

Overlay wrapper and element animation should start together #10232

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Oct 11, 2021
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
081af5f
fix(overlay): move addModalClasses to show method #9882
PlamenaMiteva Oct 4, 2021
550c0ed
chore(overlay): update sample to allow change of animations duration
wnvko Oct 4, 2021
709b5fe
fix(overlay): implement removeModalClasses method #9882
PlamenaMiteva Oct 4, 2021
bfd8a4d
Merge branch 'master' into PMiteva/fix-overlay-animation
wnvko Oct 4, 2021
f7e3a30
test(overlay): fix failing test #9882
PlamenaMiteva Oct 4, 2021
58f92c0
Merge branch 'PMiteva/fix-overlay-animation' of https://github.com/Ig…
PlamenaMiteva Oct 4, 2021
b6dad79
chore(overlay): addressing comments #9882
PlamenaMiteva Oct 4, 2021
7884a7e
test(overlay): fix failing test #9882
PlamenaMiteva Oct 5, 2021
bcf261c
test(overlay): fix failing test #9882
PlamenaMiteva Oct 5, 2021
7ab77c1
Merge branch 'master' into PMiteva/fix-overlay-animation
Lipata Oct 5, 2021
8a25b14
test(overlay): addressing comments #9882
PlamenaMiteva Oct 5, 2021
74d0248
Merge branch 'PMiteva/fix-overlay-animation' of https://github.com/Ig…
PlamenaMiteva Oct 5, 2021
68ad335
fix(overlay): wrap class addition in RAF #9882
PlamenaMiteva Oct 7, 2021
caa4c0e
Merge branch 'master' into PMiteva/fix-overlay-animation
wnvko Oct 7, 2021
4b57255
chore(overlay): addressing comments #9882
PlamenaMiteva Oct 8, 2021
4fe6347
Merge branch 'PMiteva/fix-overlay-animation' of https://github.com/Ig…
PlamenaMiteva Oct 8, 2021
72803a5
Merge branch 'master' into PMiteva/fix-overlay-animation
kdinev Oct 8, 2021
1230e1e
test(overlay): fix failing tests#9882
PlamenaMiteva Oct 8, 2021
d5ca76d
Merge branch 'PMiteva/fix-overlay-animation' of https://github.com/Ig…
PlamenaMiteva Oct 8, 2021
3a0844f
chore(overlay): fix lint errors#9882
PlamenaMiteva Oct 8, 2021
5e61d05
test(overlay): fix failing dialog test#9882
PlamenaMiteva Oct 8, 2021
34c8d89
Merge branch 'master' into PMiteva/fix-overlay-animation
Lipata Oct 8, 2021
5e9d93e
Merge branch 'master' into PMiteva/fix-overlay-animation
Lipata Oct 8, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -3020,8 +3020,8 @@ describe('igxOverlay', () => {
tick();

wrapperElement = (fixture.nativeElement as HTMLElement)
.parentElement.getElementsByClassName(CLASS_OVERLAY_WRAPPER_MODAL)[0] as HTMLElement;
expect(wrapperElement.style.visibility).toEqual('hidden');
.parentElement.getElementsByClassName(CLASS_OVERLAY_WRAPPER)[0] as HTMLElement;
expect(wrapperElement.style.visibility).toEqual('hidden');
}));

it('Should not close the component when esc key is pressed and closeOnEsc is false', fakeAsync(() => {
Expand Down Expand Up @@ -3137,7 +3137,7 @@ describe('igxOverlay', () => {
UIInteractions.triggerKeyDownEvtUponElem('Escape', document);
tick();
wrapperElement = (fixture.nativeElement as HTMLElement)
.parentElement.getElementsByClassName(CLASS_OVERLAY_WRAPPER_MODAL)[0] as HTMLElement;
.parentElement.getElementsByClassName(CLASS_OVERLAY_WRAPPER)[0] as HTMLElement;
expect(wrapperElement.style.visibility).toEqual('hidden');
}));

Expand Down
11 changes: 10 additions & 1 deletion projects/igniteui-angular/src/lib/services/overlay/overlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,6 @@ export class IgxOverlayService implements OnDestroy {
this.addOutsideClickListener(info);
this.addResizeHandler();
this.addCloseOnEscapeListener(info);
this.addModalClasses(info);
this.buildAnimationPlayers(info);
return info.id;
}
Expand Down Expand Up @@ -708,6 +707,7 @@ export class IgxOverlayService implements OnDestroy {
// to eliminate flickering show the element just before animation start
info.wrapperElement.style.visibility = '';
info.visible = true;
this.addModalClasses(info);
info.openAnimationPlayer.play();
}

Expand Down Expand Up @@ -735,6 +735,7 @@ export class IgxOverlayService implements OnDestroy {

this.animationStarting.emit({ id: info.id, animationPlayer: info.closeAnimationPlayer, animationType: 'close' });
info.event = event;
this.removeModalClasses(info);
info.closeAnimationPlayer.play();
}

Expand Down Expand Up @@ -887,6 +888,14 @@ export class IgxOverlayService implements OnDestroy {
}
}

private removeModalClasses(info: OverlayInfo) {
if (info.settings.modal) {
const wrapperElement = info.elementRef.nativeElement.parentElement.parentElement;
wrapperElement.classList.remove('igx-overlay__wrapper--modal');
wrapperElement.classList.add('igx-overlay__wrapper');
}
}

private buildAnimationPlayers(info: OverlayInfo) {
if (info.settings.positionStrategy.settings.openAnimation) {
const animationBuilder = this.builder.build(info.settings.positionStrategy.settings.openAnimation);
Expand Down
4 changes: 4 additions & 0 deletions src/app/overlay/overlay.sample.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@
<input igxInput name="dropDownWidth" type="number" [(ngModel)]="dropDownWidth">
<label igxLabel for="dropDownWidth">Drop down width</label>
</igx-input-group>
<igx-input-group>
<input igxInput name="animationLength" type="number" [(ngModel)]="animationLength">
<label igxLabel for="animationLength">Animation length in ms</label>
</igx-input-group>
</div>
</div>
<div #outlet class="outlet column">
Expand Down
8 changes: 7 additions & 1 deletion src/app/overlay/overlay.sample.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import {
NoOpScrollStrategy,
ElasticPositionStrategy,
IgxDragDirective,
ContainerPositionStrategy
ContainerPositionStrategy,
IAnimationParams
} from 'igniteui-angular';

@Component({
Expand Down Expand Up @@ -48,6 +49,7 @@ export class OverlaySampleComponent implements OnInit {
public closeOnOutsideClick = true;
public modal = true;
public useOutlet = false;
public animationLength = 300; // in ms

private xAddition = 0;
private yAddition = 0;
Expand Down Expand Up @@ -341,6 +343,10 @@ export class OverlaySampleComponent implements OnInit {
this.cdr.detectChanges();
this.onChange2();
this._overlaySettings.target = this.button.nativeElement;
(this._overlaySettings.positionStrategy.settings.openAnimation.options.params as IAnimationParams).duration
= `${this.animationLength}ms`;
(this._overlaySettings.positionStrategy.settings.closeAnimation.options.params as IAnimationParams).duration
= `${this.animationLength}ms`;
}
this.igxDropDown.toggle(this._overlaySettings);
}
Expand Down