Skip to content

Commit 282cb21

Browse files
authored
Merge branch 'master' into mpopov/fix/button/fix-for-14759
2 parents a300f9e + c6eb931 commit 282cb21

File tree

7 files changed

+59
-6
lines changed

7 files changed

+59
-6
lines changed

projects/igniteui-angular/src/lib/date-range-picker/date-range-picker.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
</ng-template>
1717

1818
<ng-template #defIcon>
19-
<igx-icon family="default" name="date_range" [attr.aria-hidden]="true"></igx-icon>
19+
<igx-icon family="default" name="date_range"></igx-icon>
2020
</ng-template>
2121

2222
<ng-template #defDateSeparatorTemplate>{{ dateSeparator }}</ng-template>

projects/igniteui-angular/src/lib/date-range-picker/date-range-picker.component.spec.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1276,6 +1276,26 @@ describe('IgxDateRangePicker', () => {
12761276
expect(dateRange.opening.emit).toHaveBeenCalledTimes(0);
12771277
expect(dateRange.opened.emit).toHaveBeenCalledTimes(0);
12781278
}));
1279+
1280+
it('should keep the calendar open when input is focused by click and while typing', fakeAsync(() => {
1281+
fixture.componentInstance.dateRange.open();
1282+
fixture.detectChanges();
1283+
tick(DEBOUNCE_TIME);
1284+
1285+
startInput.triggerEventHandler('focus', {});
1286+
fixture.detectChanges();
1287+
UIInteractions.simulateClickAndSelectEvent(startInput.nativeElement);
1288+
fixture.detectChanges();
1289+
tick(DEBOUNCE_TIME);
1290+
1291+
expect(dateRange.collapsed).toBeFalsy();
1292+
1293+
UIInteractions.simulateTyping('01/10/202', startInput);
1294+
fixture.detectChanges();
1295+
tick(DEBOUNCE_TIME);
1296+
1297+
expect(dateRange.collapsed).toBeFalsy();
1298+
}));
12791299
});
12801300

12811301
it('should focus the last focused input after the calendar closes - dropdown', fakeAsync(() => {

projects/igniteui-angular/src/lib/date-range-picker/date-range-picker.component.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,11 @@ export class IgxDateRangePickerComponent extends PickerBaseDirective
789789
this.opened.emit({ owner: this });
790790
});
791791

792-
this._overlayService.closing.pipe(...this._overlaySubFilter).subscribe((e) => {
792+
this._overlayService.closing.pipe(...this._overlaySubFilter).subscribe((e: OverlayCancelableEventArgs) => {
793+
const isEscape = e.event && (e.event as KeyboardEvent).key === this.platform.KEYMAP.ESCAPE;
794+
if (this.isProjectedInputTarget(e.event) && !isEscape) {
795+
e.cancel = true;
796+
}
793797
this.handleClosing(e as OverlayCancelableEventArgs);
794798
});
795799

@@ -803,6 +807,16 @@ export class IgxDateRangePickerComponent extends PickerBaseDirective
803807
});
804808
}
805809

810+
private isProjectedInputTarget(event: Event): boolean {
811+
if (!this.hasProjectedInputs || !event) {
812+
return false;
813+
}
814+
const path = event.composed ? event.composedPath() : [event.target];
815+
return this.projectedInputs.some(i =>
816+
path.includes(i.dateTimeEditor.nativeElement)
817+
);
818+
}
819+
806820
private updateValue(value: DateRange) {
807821
this._value = value ? value : null;
808822
this.updateInputs();

projects/igniteui-angular/src/lib/expansion-panel/expansion-panel-header.component.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
@if (!iconTemplate) {
1313
<igx-icon
1414
family="default"
15-
[name]="panel.collapsed ? 'expand' : 'collapse'"
16-
[attr.aria-hidden]="true">
15+
[name]="panel.collapsed ? 'expand' : 'collapse'">
1716
</igx-icon>
1817
}
1918
</div>

projects/igniteui-angular/src/lib/icon/icon.component.spec.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,23 @@ describe("Icon", () => {
3030
el = debugElement.nativeElement;
3131
});
3232

33-
it("should instatiate with defaults", () => {
33+
it("should instantiate with defaults", () => {
3434
fixture.detectChanges();
3535

3636
expect(instance.getFamily).toBe("material");
3737
expect(instance.getActive).toBe(true);
38+
expect(instance.ariaHidden).toBe(true);
39+
});
40+
41+
it("should be able to set the aria-hidden attribute", () => {
42+
fixture.detectChanges();
43+
44+
expect(el.getAttribute('aria-hidden')).toBe("true");
45+
46+
instance.ariaHidden = false;
47+
fixture.detectChanges();
48+
49+
expect(el.getAttribute('aria-hidden')).toBe("false");
3850
});
3951

4052
it("should set icon as inactive", () => {

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,14 @@ export class IgxIconComponent implements OnInit, OnChanges, OnDestroy {
8080
return !this.active;
8181
}
8282

83+
/**
84+
* The `aria-hidden` attribute of the icon.
85+
* By default is set to 'true'.
86+
*/
87+
@HostBinding("attr.aria-hidden")
88+
@Input()
89+
public ariaHidden = true;
90+
8391
/**
8492
* An @Input property that sets the value of the `family`. By default it's "material".
8593
*

projects/igniteui-angular/src/lib/select/select.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<ng-container *ngTemplateOutlet="toggleIconTemplate; context: {$implicit: this.collapsed}"></ng-container>
2828
}
2929
@if (!toggleIconTemplate) {
30-
<igx-icon family="default" [name]="toggleIcon" [attr.aria-hidden]="true"></igx-icon>
30+
<igx-icon family="default" [name]="toggleIcon"></igx-icon>
3131
}
3232
</igx-suffix>
3333
<ng-container ngProjectAs="igx-hint, [igxHint]" >

0 commit comments

Comments
 (0)