|  | 
| 7 | 7 |   // TODO(jelbourn): aria attributes tying together date input and floating calendar. | 
| 8 | 8 |   // TODO(jelbourn): make sure this plays well with validation and ngMessages. | 
| 9 | 9 |   // TODO(jelbourn): forward more attributes to the internal input (required, autofocus, etc.) | 
| 10 |  | -  // TODO(jelbourn): floating panel open animation (see animation for menu in spec). | 
| 11 | 10 |   // TODO(jelbourn): auto-grow input to accomodate longer dates | 
| 12 | 11 | 
 | 
| 13 | 12 |   // POST RELEASE | 
|  | 
| 19 | 18 | 
 | 
| 20 | 19 | 
 | 
| 21 | 20 |   angular.module('material.components.calendar') | 
| 22 |  | -      .directive('mdDatePicker', datePickerDirective); | 
|  | 21 | +      .directive('mdDatepicker', datePickerDirective); | 
| 23 | 22 | 
 | 
| 24 | 23 |   function datePickerDirective() { | 
| 25 | 24 |     return { | 
| 26 | 25 |       template: | 
|  | 26 | +          // Buttons are not in the tab order because users can open the calendar via keyboard | 
|  | 27 | +          // interaction on the text input, and multiple tab stops for one component (picker) | 
|  | 28 | +          // may be confusing. | 
| 27 | 29 |           '<md-button class="md-datepicker-button md-icon-button" type="button" ' + | 
|  | 30 | +              'tabindex="-1" aria-label="Open calendar" ' + | 
| 28 | 31 |               'ng-click="ctrl.openCalendarPane()">' + | 
| 29 | 32 |               '<md-icon class="md-datepicker-calendar-icon" md-svg-icon="md-calendar"></md-icon>' + | 
| 30 | 33 |           '</md-button>' + | 
| 31 | 34 |           '<div class="md-datepicker-input-container">' + | 
| 32 | 35 |             '<input class="md-datepicker-input">' + | 
| 33 | 36 | 
 | 
| 34 | 37 |             '<md-button md-no-ink class="md-datepicker-triangle-button md-icon-button" ' + | 
| 35 |  | -                'ng-click="ctrl.openCalendarPane()">' + | 
|  | 38 | +                'ng-click="ctrl.openCalendarPane()" tabindex="-1" aria-label="Open calendar">' + | 
| 36 | 39 |               '<div class="md-datepicker-expand-triangle"></div>' + | 
| 37 | 40 |             '</md-button>' + | 
| 38 | 41 |           '</div>' + | 
|  | 
| 41 | 44 |           '<div class="md-datepicker-calendar-pane md-whiteframe-z1">' + | 
| 42 | 45 |             '<div class="md-datepicker-input-mask"></div>' + | 
| 43 | 46 |             '<div class="md-datepicker-calendar">' + | 
| 44 |  | -              '<md-calendar ng-model="ctrl.date" ng-if="ctrl.isCalendarOpen"></md-calendar>' + | 
|  | 47 | +              '<md-calendar role="dialog" aria-label="Calendar" tabindex="0" ' + | 
|  | 48 | +                  'ng-model="ctrl.date" ng-if="ctrl.isCalendarOpen"></md-calendar>' + | 
| 45 | 49 |             '</div>' + | 
| 46 | 50 |           '</div>', | 
| 47 |  | -      require: ['ngModel', 'mdDatePicker'], | 
|  | 51 | +      require: ['ngModel', 'mdDatepicker'], | 
| 48 | 52 |       scope: { | 
| 49 | 53 |         placeholder: '@mdPlaceholder' | 
| 50 | 54 |       }, | 
|  | 
| 69 | 73 |    * @ngInject @constructor | 
| 70 | 74 |    */ | 
| 71 | 75 |   function DatePickerCtrl($scope, $element, $attrs, $compile, $timeout, $mdConstant, $mdUtil, | 
| 72 |  | -      $$mdDateLocale, $$mdDateUtil, $mdMenu, $$rAF) { | 
|  | 76 | +      $$mdDateLocale, $$mdDateUtil, $$rAF) { | 
| 73 | 77 |     /** @final */ | 
| 74 | 78 |     this.$compile = $compile; | 
| 75 | 79 | 
 | 
|  | 
| 89 | 93 |     this.$mdUtil = $mdUtil; | 
| 90 | 94 | 
 | 
| 91 | 95 |     /** @final */ | 
| 92 |  | -    this.$mdMenu = $mdMenu; | 
| 93 |  | - | 
| 94 | 96 |     this.$$rAF = $$rAF; | 
| 95 | 97 | 
 | 
| 96 | 98 |     /** @type {!angular.NgModelController} */ | 
|  | 
| 250 | 252 |     calendarPane.style.top = (elementRect.top - bodyRect.top) + 'px'; | 
| 251 | 253 |     document.body.appendChild(this.calendarPane); | 
| 252 | 254 | 
 | 
| 253 |  | -    // Add CSS class after one frame to trigger animation. | 
|  | 255 | +    // Add CSS class after one frame to trigger open animation. | 
| 254 | 256 |     this.$$rAF(function() { | 
| 255 | 257 |       calendarPane.classList.add('md-pane-open'); | 
| 256 | 258 |     }); | 
|  | 
0 commit comments