Commit 64267618 authored by tkent@chromium.org's avatar tkent@chromium.org

AX: Calendar Picker: Initial day selection should notify ActiveDescendantChanged a11y event.

AXRenderObject assumes that both of the ancestor element and the active
descendant element have their renderers.

BUG=123896

Review URL: https://codereview.chromium.org/550853002

git-svn-id: svn://svn.chromium.org/blink/trunk@181547 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent ae037838
...@@ -4,6 +4,8 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE ...@@ -4,6 +4,8 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
Focused: AXDescription: Focused: AXDescription:
Focused: AXDescription: Sunday, January 2, 2000
PASS Received ActiveDescendantChanged
Focused: AXDescription: Monday, January 3, 2000 Focused: AXDescription: Monday, January 3, 2000
PASS Received ActiveDescendantChanged PASS Received ActiveDescendantChanged
PASS successfullyParsed is true PASS successfullyParsed is true
......
...@@ -16,9 +16,11 @@ window.accessibilityController.setNotificationListener(function(axnode, type) { ...@@ -16,9 +16,11 @@ window.accessibilityController.setNotificationListener(function(axnode, type) {
debug('Focused: ' + accessibilityController.focusedElement.description); debug('Focused: ' + accessibilityController.focusedElement.description);
} else if (type == 'ActiveDescendantChanged') { } else if (type == 'ActiveDescendantChanged') {
testPassed('Received ActiveDescendantChanged'); testPassed('Received ActiveDescendantChanged');
finishJSTest(); if (++activeDescendantCounter >= 2)
finishJSTest();
} }
}); });
var activeDescendantCounter = 0;
var date1 = document.getElementById('date1'); var date1 = document.getElementById('date1');
openPicker(date1, test1); openPicker(date1, test1);
......
...@@ -3519,6 +3519,7 @@ CalendarTableView.prototype.updateCells = function() { ...@@ -3519,6 +3519,7 @@ CalendarTableView.prototype.updateCells = function() {
var currentMonth = this.calendarPicker.currentMonth(); var currentMonth = this.calendarPicker.currentMonth();
var firstDayInCurrentMonth = currentMonth.firstDay().valueOf(); var firstDayInCurrentMonth = currentMonth.firstDay().valueOf();
var lastDayInCurrentMonth = currentMonth.lastDay().valueOf(); var lastDayInCurrentMonth = currentMonth.lastDay().valueOf();
var activeDayCell = null;
for (var dayString in this._dayCells) { for (var dayString in this._dayCells) {
var dayCell = this._dayCells[dayString]; var dayCell = this._dayCells[dayString];
var day = dayCell.day; var day = dayCell.day;
...@@ -3527,7 +3528,7 @@ CalendarTableView.prototype.updateCells = function() { ...@@ -3527,7 +3528,7 @@ CalendarTableView.prototype.updateCells = function() {
var isHighlighted = day >= firstDayInHighlight && day <= lastDayInHighlight; var isHighlighted = day >= firstDayInHighlight && day <= lastDayInHighlight;
dayCell.setHighlighted(isHighlighted); dayCell.setHighlighted(isHighlighted);
if (isHighlighted && firstDayInHighlight == lastDayInHighlight) if (isHighlighted && firstDayInHighlight == lastDayInHighlight)
this.element.setAttribute("aria-activedescendant", dayCell.element.id); activeDayCell = dayCell;
dayCell.setIsInCurrentMonth(day >= firstDayInCurrentMonth && day <= lastDayInCurrentMonth); dayCell.setIsInCurrentMonth(day >= firstDayInCurrentMonth && day <= lastDayInCurrentMonth);
dayCell.setDisabled(!this.calendarPicker.isValidDay(day)); dayCell.setDisabled(!this.calendarPicker.isValidDay(day));
} }
...@@ -3540,6 +3541,13 @@ CalendarTableView.prototype.updateCells = function() { ...@@ -3540,6 +3541,13 @@ CalendarTableView.prototype.updateCells = function() {
weekNumberCell.setDisabled(!this.calendarPicker.isValid(week)); weekNumberCell.setDisabled(!this.calendarPicker.isValid(week));
} }
} }
if (activeDayCell) {
// Ensure a renderer because an element with no renderer doesn't post
// activedescendant events. This shouldn't run in the above |for| loop
// to avoid CSS transition.
activeDayCell.element.offsetLeft;
this.element.setAttribute("aria-activedescendant", activeDayCell.element.id);
}
}; };
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment