Skip to content

Commit e87172e

Browse files
authored
Merge branch '11.1.x' into gedinakova/fix-9465-11.1
2 parents 080f407 + 495852d commit e87172e

File tree

4 files changed

+36
-10
lines changed

4 files changed

+36
-10
lines changed

projects/igniteui-angular/src/lib/carousel/carousel.component.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ export class IgxCarouselComponent implements OnDestroy, AfterContentInit {
563563
if (this.keyboardSupport) {
564564
event.preventDefault();
565565
this.next();
566-
requestAnimationFrame(() => this.slides.find(s => s.active).nativeElement.focus());
566+
this.focusSlideElement();
567567
}
568568
}
569569

@@ -573,7 +573,7 @@ export class IgxCarouselComponent implements OnDestroy, AfterContentInit {
573573
if (this.keyboardSupport) {
574574
event.preventDefault();
575575
this.prev();
576-
requestAnimationFrame(() => this.slides.find(s => s.active).nativeElement.focus());
576+
this.focusSlideElement();
577577
}
578578
}
579579

@@ -599,7 +599,7 @@ export class IgxCarouselComponent implements OnDestroy, AfterContentInit {
599599
if (this.keyboardSupport && this.slides.length > 0) {
600600
event.preventDefault();
601601
this.slides.first.active = true;
602-
requestAnimationFrame(() => this.slides.find(s => s.active).nativeElement.focus());
602+
this.focusSlideElement();
603603
}
604604
}
605605

@@ -609,7 +609,7 @@ export class IgxCarouselComponent implements OnDestroy, AfterContentInit {
609609
if (this.keyboardSupport && this.slides.length > 0) {
610610
event.preventDefault();
611611
this.slides.last.active = true;
612-
requestAnimationFrame(() => this.slides.find(s => s.active).nativeElement.focus());
612+
this.focusSlideElement();
613613
}
614614
}
615615

@@ -1125,6 +1125,16 @@ export class IgxCarouselComponent implements OnDestroy, AfterContentInit {
11251125
});
11261126
}
11271127
}
1128+
private focusSlideElement() {
1129+
if (this.leaveAnimationPlayer) {
1130+
this.leaveAnimationPlayer.onDone(() => {
1131+
this.slides.find(s => s.active).nativeElement.focus();
1132+
});
1133+
} else {
1134+
requestAnimationFrame(() => this.slides.find(s => s.active).nativeElement.focus());
1135+
}
1136+
}
1137+
11281138
}
11291139

11301140
export interface ISlideEventArgs extends IBaseEventArgs {

src/app/carousel/carousel.sample.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ export class CarouselSampleComponent {
2222

2323
public addNewSlide() {
2424
this.slides.push(
25-
{image: 'assets/images/carousel/[email protected]'},
26-
{image: 'assets/images/carousel/[email protected]'},
27-
{image: 'assets/images/carousel/[email protected]'}
25+
{image: 'assets/images/carousel/[email protected]', active: true},
26+
{image: 'assets/images/carousel/[email protected]', active: false},
27+
{image: 'assets/images/carousel/[email protected]', active: false}
2828
);
2929
}
3030

src/app/grid-filter-template/grid-filter-template.sample.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@
3838
tabindex="0"
3939
placeholder="Filter..."
4040
autocomplete="off"
41-
(input)="onInput(input, column)"/>
42-
<igx-suffix *ngIf="input.value || input.value === 0" (click)="clearInput(input, column)" tabindex="0">
41+
(input)="onInput(input, column)"
42+
(keydown)="onKeyDown($event)"/>
43+
<igx-suffix *ngIf="input.value" (click)="clearInput(input, column)" tabindex="0">
4344
<igx-icon>clear</igx-icon>
4445
</igx-suffix>
4546
</igx-input-group>

src/app/grid-filter-template/grid-filter-template.sample.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,22 +489,37 @@ export class GridFilterTemplateSampleComponent implements OnInit {
489489

490490
public onInput(input: any, column: IgxColumnComponent) {
491491
let operand = null;
492+
let value = input.value;
493+
494+
if (value === '') {
495+
this.grid1.clearFilter(column.field);
496+
return;
497+
}
498+
492499
switch (column.dataType) {
493500
case DataType.Number:
501+
value = Number.parseInt(value, 10);
494502
operand = IgxNumberFilteringOperand.instance().condition('equals');
495503
break;
496504
case DataType.Date:
505+
value = new Date(value);
497506
operand = IgxDateFilteringOperand.instance().condition('equals');
498507
break;
499508
default:
500509
operand = IgxStringFilteringOperand.instance().condition('contains');
501510
break;
502511
}
503-
this.grid1.filter(column.field, input.value, operand, column.filteringIgnoreCase);
512+
513+
this.grid1.filter(column.field, value, operand, column.filteringIgnoreCase);
504514
}
505515

506516
public clearInput(input: any, column: any) {
507517
input.value = null;
508518
this.grid1.clearFilter(column.field);
509519
}
520+
521+
public onKeyDown(event: KeyboardEvent) {
522+
event.stopImmediatePropagation();
523+
}
524+
510525
}

0 commit comments

Comments
 (0)