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

Unified Diff: chrome/common/extensions/docs/examples/apps/calculator/view.js

Issue 11189028: Improve accessibility of Calculator default app. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/docs/examples/apps/calculator/view.js
diff --git a/chrome/common/extensions/docs/examples/apps/calculator/view.js b/chrome/common/extensions/docs/examples/apps/calculator/view.js
index c810038beb5d653e4ce7093e05a50ec4a0f065c7..fe4b0332de6ee2edad95af9400ffca78a990ce6d 100644
--- a/chrome/common/extensions/docs/examples/apps/calculator/view.js
+++ b/chrome/common/extensions/docs/examples/apps/calculator/view.js
@@ -77,6 +77,8 @@ function View(calcModel) {
shift = false;
});
+ this.displayElement.attr('role', 'log');
+ this.displayElement.attr('aria-live', 'polite');
dharcourt 2012/10/17 04:22:44 Most of the HTML in newer versions of the calculat
}
@@ -144,17 +146,19 @@ View.prototype.UpdateTotal = function(accumulator) {
View.prototype.AddDisplayEquation = function(operator, operand, accumulator) {
this.displayElement.append(
'<div class="equation">'
- + '<div class="operand">' + operand + '</div>'
- + '<div class="operator">' + operator + '</div>'
- + '<div class="accumulator">' + accumulator + '</div'
+ + '<div class="operand_wrapper">'
+ + '<span class="operator">' + operator + '</span>'
+ + '<span class="operand">' + operand + '</span>'
+ + '</div>'
+ + '<div class="accumulator" aria-hidden="true">' + accumulator + '</div'
+ '</div>');
this.lastDisplayElement = $('.equation').last();
this.displayElement.scrollTop(this.displayElement[0].scrollHeight);
}
dharcourt 2012/10/17 04:22:44 This will need to be done just a bit differently i
View.prototype.UpdateDisplayEquation = function(operator, operand, accumulator) {
- $(this.lastDisplayElement).children('.operator').text(operator);
- $(this.lastDisplayElement).children('.operand').text(operand);
+ $(this.lastDisplayElement).find('.operator').text(operator);
+ $(this.lastDisplayElement).find('.operand').text(operand);
dharcourt 2012/10/17 04:22:44 JQuery has been removed from the newer Calculator
$(this.lastDisplayElement).children('.accumulator').text(accumulator);
this.displayElement.scrollTop(this.displayElement[0].scrollHeight);
}
@@ -198,5 +202,6 @@ View.prototype.AddRow = function() {
}
View.prototype.AddButton = function(row, value, button_value) {
- row.append('<div class="calc-button ' + button_value + '">' + '</div>');
+ row.append('<button aria-label="' + button_value + '" class="calc-button ' +
+ button_value + '">' + '</button>');
dharcourt 2012/10/17 04:22:44 This can now be encoded directly in the HTML.
}

Powered by Google App Engine
This is Rietveld 408576698