diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d1ee468e50..ea76de667e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,7 +30,7 @@ All notable changes for each version of this project will be documented in this - `onOpening` and `onClosing` events are emitting now arguments of `ToggleViewCancelableEventArgs` type. - `IgxSelect` - Added `aria-labelledby` property for the items list container(marked as `role="listbox"`). This will ensure the users of assistive technologies will also know what the list items container is used for, upon opening. -- `IgxDatePicker` +- `IgxDatePicker` - **Breaking Change** - Deprecated the `label` property. - Added `aria-labelledby` property for the input field. This will ensure the users of assistive technologies will also know what component is used for, upon input focus. - `igxNavigationDrawer` @@ -38,7 +38,9 @@ All notable changes for each version of this project will be documented in this - `igxTabs` - Added `disableAnimation` property which enables/disables the transition animation of the tabs' content. Set to `false` by default. - `IgxExpansionPanel` - - `IExpansionPanelEventArgs.panel` - Deprecated. Usе `owner` property to get a reference to the panel. + - `IExpansionPanelEventArgs.panel` - Deprecated. Usе `owner` property to get a reference to the panel. +- `IgxCalendarComponent`, `IgxMonthsViewComponent` and `IgxYearsViewComponent` + - `tabIndex` property was removed in order to improve on page navigation and to be compliant with W3 accessability recommendations; Also the date grid in the calendar is now only one tab stop, the same approach is applied and in the `IgxMonthsViewComponent` and `IgxYearsViewComponent`; ### New Features - `IgxGrid`, `IgxTreeGrid`, `IgxHierarchicalGrid` diff --git a/projects/igniteui-angular/src/lib/calendar/calendar-multi-view.component.spec.ts b/projects/igniteui-angular/src/lib/calendar/calendar-multi-view.component.spec.ts index 9039d622201..05d8269dc85 100644 --- a/projects/igniteui-angular/src/lib/calendar/calendar-multi-view.component.spec.ts +++ b/projects/igniteui-angular/src/lib/calendar/calendar-multi-view.component.spec.ts @@ -554,6 +554,45 @@ describe('Multi-View Calendar - ', () => { HelperTestFunctions.verifyCalendarSubHeaders(fixture, [march2020, april2020, may2020]); })); + it('Verify tabindex is correct when navigating with arrow keys', fakeAsync(() => { + calendar.hideOutsideDays = true; + fixture.detectChanges(); + + let dates = HelperTestFunctions.getMonthViewDates(fixture, 0); + UIInteractions.simulateClickEvent(dates[0]); + fixture.detectChanges(); + tick(); + + UIInteractions.triggerKeyDownEvtUponElem('ArrowDown', dates[0]); + fixture.detectChanges(); + tick(); + dates = HelperTestFunctions.getMonthViewDates(fixture, 0); + expect(document.activeElement).toEqual(dates[7]); + expect(dates[7].tabIndex).toBe(0); + + UIInteractions.triggerKeyDownEvtUponElem('ArrowUp', dates[7]); + fixture.detectChanges(); + tick(); + dates = HelperTestFunctions.getMonthViewDates(fixture, 0); + expect(document.activeElement).toEqual(dates[0]); + expect(dates[0].tabIndex).toBe(0); + + UIInteractions.triggerKeyDownEvtUponElem('ArrowRight', dates[0]); + fixture.detectChanges(); + tick(); + dates = HelperTestFunctions.getMonthViewDates(fixture, 0); + expect(document.activeElement).toEqual(dates[1]); + expect(dates[1].tabIndex).toBe(0); + + UIInteractions.triggerKeyDownEvtUponElem('ArrowLeft', dates[1]); + fixture.detectChanges(); + tick(); + dates = HelperTestFunctions.getMonthViewDates(fixture, 0); + expect(document.activeElement).toEqual(dates[0]); + expect(dates[0].tabIndex).toBe(0); + })); + + it('Verify navigation with pageUp', fakeAsync(() => { let monthDates = HelperTestFunctions.getMonthViewDates(fixture, 1); UIInteractions.simulateClickEvent(monthDates[16]); @@ -694,17 +733,19 @@ describe('Multi-View Calendar - ', () => { fixture.detectChanges(); inactiveDates = HelperTestFunctions.getMonthViewInactiveDates(fixture, 0); inactiveDates.forEach(date => { - expect(date.tabIndex).toEqual(0); + expect(date.tabIndex).toEqual(-1); }); monthDates = HelperTestFunctions.getMonthViewDates(fixture, 0); for (let index = 6; index < 14; index++) { - expect(monthDates[index].tabIndex).toEqual(0); + expect(monthDates[index].tabIndex).toEqual(-1); } + + expect(monthDates[0].tabIndex).toEqual(0); })); - it('Verify navigation with Home and End keys', fakeAsync(() => { + it('Verify navigation with Home and End keys and check the tabindex', fakeAsync(() => { let monthDates = HelperTestFunctions.getMonthViewDates(fixture, 1); UIInteractions.simulateClickEvent(monthDates[16]); fixture.detectChanges(); @@ -716,6 +757,8 @@ describe('Multi-View Calendar - ', () => { monthDates = HelperTestFunctions.getMonthViewDates(fixture, 0); expect(document.activeElement).toEqual(monthDates[0]); + expect(monthDates[0].tabIndex).toEqual(0); + UIInteractions.triggerKeyDownEvtUponElem('End', monthDates[0], true); fixture.detectChanges(); @@ -723,6 +766,8 @@ describe('Multi-View Calendar - ', () => { monthDates = HelperTestFunctions.getMonthViewDates(fixture, 2); expect(document.activeElement).toEqual(monthDates[monthDates.length - 1]); + expect(monthDates[monthDates.length - 1].tabIndex).toEqual(0); + })); it('Verify navigation with Home and End keys when there are disabled dates', fakeAsync(() => { diff --git a/projects/igniteui-angular/src/lib/calendar/calendar.component.html b/projects/igniteui-angular/src/lib/calendar/calendar.component.html index 628f67245ac..f1612c21944 100644 --- a/projects/igniteui-angular/src/lib/calendar/calendar.component.html +++ b/projects/igniteui-angular/src/lib/calendar/calendar.component.html @@ -50,6 +50,7 @@