Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: Source/web/resources/calendarPicker.js

Issue 550853002: AX: Calendar Picker: Initial day selection should notify ActiveDescendantChanged a11y event. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « LayoutTests/fast/forms/calendar-picker/date-picker-ax-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 "use strict"; 1 "use strict";
2 /* 2 /*
3 * Copyright (C) 2012 Google Inc. All rights reserved. 3 * Copyright (C) 2012 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 3501 matching lines...) Expand 10 before | Expand all | Expand 10 after
3512 if (highlight) { 3512 if (highlight) {
3513 firstDayInHighlight = highlight.firstDay().valueOf(); 3513 firstDayInHighlight = highlight.firstDay().valueOf();
3514 lastDayInHighlight = highlight.lastDay().valueOf(); 3514 lastDayInHighlight = highlight.lastDay().valueOf();
3515 } else { 3515 } else {
3516 firstDayInHighlight = Infinity; 3516 firstDayInHighlight = Infinity;
3517 lastDayInHighlight = Infinity; 3517 lastDayInHighlight = Infinity;
3518 } 3518 }
3519 var currentMonth = this.calendarPicker.currentMonth(); 3519 var currentMonth = this.calendarPicker.currentMonth();
3520 var firstDayInCurrentMonth = currentMonth.firstDay().valueOf(); 3520 var firstDayInCurrentMonth = currentMonth.firstDay().valueOf();
3521 var lastDayInCurrentMonth = currentMonth.lastDay().valueOf(); 3521 var lastDayInCurrentMonth = currentMonth.lastDay().valueOf();
3522 var activeDayCell = null;
3522 for (var dayString in this._dayCells) { 3523 for (var dayString in this._dayCells) {
3523 var dayCell = this._dayCells[dayString]; 3524 var dayCell = this._dayCells[dayString];
3524 var day = dayCell.day; 3525 var day = dayCell.day;
3525 dayCell.setIsToday(Day.createFromToday().equals(day)); 3526 dayCell.setIsToday(Day.createFromToday().equals(day));
3526 dayCell.setSelected(day >= firstDayInSelection && day <= lastDayInSelect ion); 3527 dayCell.setSelected(day >= firstDayInSelection && day <= lastDayInSelect ion);
3527 var isHighlighted = day >= firstDayInHighlight && day <= lastDayInHighli ght; 3528 var isHighlighted = day >= firstDayInHighlight && day <= lastDayInHighli ght;
3528 dayCell.setHighlighted(isHighlighted); 3529 dayCell.setHighlighted(isHighlighted);
3529 if (isHighlighted && firstDayInHighlight == lastDayInHighlight) 3530 if (isHighlighted && firstDayInHighlight == lastDayInHighlight)
3530 this.element.setAttribute("aria-activedescendant", dayCell.element.i d); 3531 activeDayCell = dayCell;
3531 dayCell.setIsInCurrentMonth(day >= firstDayInCurrentMonth && day <= last DayInCurrentMonth); 3532 dayCell.setIsInCurrentMonth(day >= firstDayInCurrentMonth && day <= last DayInCurrentMonth);
3532 dayCell.setDisabled(!this.calendarPicker.isValidDay(day)); 3533 dayCell.setDisabled(!this.calendarPicker.isValidDay(day));
3533 } 3534 }
3534 if (this.hasWeekNumberColumn) { 3535 if (this.hasWeekNumberColumn) {
3535 for (var weekString in this._weekNumberCells) { 3536 for (var weekString in this._weekNumberCells) {
3536 var weekNumberCell = this._weekNumberCells[weekString]; 3537 var weekNumberCell = this._weekNumberCells[weekString];
3537 var week = weekNumberCell.week; 3538 var week = weekNumberCell.week;
3538 weekNumberCell.setSelected(selection && selection.equals(week)); 3539 weekNumberCell.setSelected(selection && selection.equals(week));
3539 weekNumberCell.setHighlighted(highlight && highlight.equals(week)); 3540 weekNumberCell.setHighlighted(highlight && highlight.equals(week));
3540 weekNumberCell.setDisabled(!this.calendarPicker.isValid(week)); 3541 weekNumberCell.setDisabled(!this.calendarPicker.isValid(week));
3541 } 3542 }
3542 } 3543 }
3544 if (activeDayCell) {
3545 // Ensure a renderer because an element with no renderer doesn't post
3546 // activedescendant events. This shouldn't run in the above |for| loop
3547 // to avoid CSS transition.
3548 activeDayCell.element.offsetLeft;
3549 this.element.setAttribute("aria-activedescendant", activeDayCell.element .id);
3550 }
3543 }; 3551 };
3544 3552
3545 /** 3553 /**
3546 * @param {!Day} day 3554 * @param {!Day} day
3547 * @return {!DayCell} 3555 * @return {!DayCell}
3548 */ 3556 */
3549 CalendarTableView.prototype.prepareNewDayCell = function(day) { 3557 CalendarTableView.prototype.prepareNewDayCell = function(day) {
3550 var dayCell = DayCell.recycleOrCreate(); 3558 var dayCell = DayCell.recycleOrCreate();
3551 dayCell.reset(day); 3559 dayCell.reset(day);
3552 this._dayCells[dayCell.day.toString()] = dayCell; 3560 this._dayCells[dayCell.day.toString()] = dayCell;
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
4054 event.stopPropagation(); 4062 event.stopPropagation();
4055 event.preventDefault(); 4063 event.preventDefault();
4056 } 4064 }
4057 }; 4065 };
4058 4066
4059 if (window.dialogArguments) { 4067 if (window.dialogArguments) {
4060 initialize(dialogArguments); 4068 initialize(dialogArguments);
4061 } else { 4069 } else {
4062 window.addEventListener("message", handleMessage, false); 4070 window.addEventListener("message", handleMessage, false);
4063 } 4071 }
OLDNEW
« no previous file with comments | « LayoutTests/fast/forms/calendar-picker/date-picker-ax-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698