Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit 0777cd9

Browse files
committed
fix(calendar): clean-up code after a11y experiments
1 parent db3d06e commit 0777cd9

File tree

3 files changed

+1
-51
lines changed

3 files changed

+1
-51
lines changed

src/components/calendar/calendar.js

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,6 @@
117117
/** @final {HTMLElement} */
118118
this.calendarElement = $element[0].querySelector('.md-calendar');
119119

120-
/** @final {HTMLElement} */
121-
this.ariaLiveElement = $element[0].querySelector('[aria-live]');
122-
123-
// TODO(jelbourn): one global live region.
124-
//this.ariaLiveElement.parentNode.removeChild(this.ariaLiveElement);
125-
//document.body.appendChild(this.ariaLiveElement);
126-
127120
/** @final {HTMLElement} */
128121
this.calendarScroller = $element[0].querySelector('.md-virtual-repeat-scroller');
129122

@@ -373,32 +366,19 @@
373366
CalendarCtrl.prototype.focus = function(opt_date) {
374367
var date = opt_date || this.selectedDate;
375368

376-
if (!opt_date) {
377-
this.announceDisplayDateChange(null, date);
378-
}
379-
380369
var previousFocus = this.calendarElement.querySelector('.md-focus');
381370
if (previousFocus) {
382371
previousFocus.classList.remove('md-focus');
383-
//previousFocus.setAttribute('aria-selected', 'false');
384372
}
385373

386-
387374
var cellId = this.getDateId(date);
388375
var cell = this.calendarElement.querySelector('#' + cellId);
389376
if (cell) {
390377
cell.classList.add('md-focus');
391378
cell.focus();
392-
//this.calendarElement.setAttribute('aria-activedescendant', cell.id);
393-
//cell.setAttribute('aria-selected', 'true');
394379
} else {
395380
this.focusDate = date;
396381
}
397-
398-
//this.calendarElement.focus();
399-
400-
//this.$element[0].querySelector('.md-dummy').focus();
401-
//this.calendarElement.focus();
402382
};
403383

404384
/*** Updating the displayed / selected date ***/
@@ -461,7 +441,6 @@
461441
this.isMonthTransitionInProgress = true;
462442
var animationPromise = this.animateDateChange(date);
463443

464-
this.announceDisplayDateChange(this.displayDate, date);
465444
this.displayDate = date;
466445

467446
var self = this;
@@ -482,34 +461,6 @@
482461
return this.$q.when();
483462
};
484463

485-
/**
486-
* Announces a change in date to the calendar's aria-live region.
487-
* @param {Date} previousDate
488-
* @param {Date} currentDate
489-
*/
490-
CalendarCtrl.prototype.announceDisplayDateChange = function(previousDate, currentDate) {
491-
return;
492-
493-
// If the date has not changed at all, do nothing.
494-
if (previousDate && this.dateUtil.isSameDay(previousDate, currentDate)) {
495-
return;
496-
}
497-
498-
// If the date has changed to another date within the same month and year, make a short
499-
// announcement.
500-
if (previousDate && this.dateUtil.isSameMonthAndYear(previousDate, currentDate)) {
501-
this.ariaLiveElement.textContent = this.dateLocale.shortAnnounceFormatter(currentDate);
502-
return;
503-
}
504-
505-
// If the date has changed to another date in a different month and/or year, make a long
506-
// announcement.
507-
if (!previousDate || !this.dateUtil.isSameDay(previousDate, currentDate)) {
508-
this.ariaLiveElement.textContent = this.dateLocale.longAnnounceFormatter(currentDate);
509-
}
510-
};
511-
512-
513464
/*** Constructing the calendar table ***/
514465

515466
/**

src/components/calendar/calendarMonth.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@
150150
// Because of an NVDA bug (with Firefox), the row needs an aria-label in order
151151
// to prevent the entire row being read aloud when the user moves between rows.
152152
// See http://community.nvda-project.org/ticket/4643.
153-
//row.setAttribute('aria-label', this.dateLocale.weekNumberFormatter(rowNumber));
153+
row.setAttribute('aria-label', this.dateLocale.weekNumberFormatter(rowNumber));
154154

155155
return row;
156156
};

src/components/calendar/datePicker.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
// TODO(jelbourn): Documentation
66
// TODO(jelbourn): Demo that uses moment.js
77
// TODO(jelbourn): make sure this plays well with validation and ngMessages.
8-
// TODO(jelbourn): auto-grow input to accomodate longer dates
98

109
// POST RELEASE
1110
// TODO(jelbourn): forward more attributes to the internal input (required, autofocus, etc.)

0 commit comments

Comments
 (0)