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

Unified Diff: Source/WebCore/Resources/pagepopups/calendarPicker.js

Issue 10956071: Merge 129094 - REGRESSION(r127727): Calendar picker focus ring should be hidden until key event (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1271/
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/Resources/pagepopups/calendarPicker.js
===================================================================
--- Source/WebCore/Resources/pagepopups/calendarPicker.js (revision 129358)
+++ Source/WebCore/Resources/pagepopups/calendarPicker.js (working copy)
@@ -72,7 +72,6 @@
*/
var global = {
argumentsReceived: false,
- hadKeyEvent: false,
params: null
};
@@ -267,11 +266,9 @@
* @param {!Object} args
*/
function initialize(args) {
- var main = $("main");
- main.classList.add(ClassNames.NoFocusRing);
-
var errorString = validateArguments(args);
if (errorString) {
+ var main = $("main");
main.textContent = "Internal error: " + errorString;
resizeWindow(main.offsetWidth, main.offsetHeight);
} else {
@@ -305,6 +302,7 @@
this.step = (typeof this._config.step !== undefined) ? this._config.step * CalendarPicker.BaseStep : CalendarPicker.BaseStep;
this.yearMonthController = new YearMonthController(this);
this.daysTable = new DaysTable(this);
+ this._hadKeyEvent = false;
this._layout();
var initialDate = parseDateString(this._config.currentValue);
if (initialDate < this.minimumDate)
@@ -328,6 +326,8 @@
this.yearMonthController.attachTo(this._element);
this.daysTable.attachTo(this._element);
this._layoutButtons();
+ // DaysTable will have focus but we don't want to show its focus ring until the first key event.
+ this._element.classList.add(ClassNames.NoFocusRing);
};
CalendarPicker.prototype.handleToday = function() {
@@ -1056,7 +1056,7 @@
* @param {Event} event
*/
DaysTable.prototype._handleKey = function(event) {
- maybeUpdateFocusStyle();
+ this.picker.maybeUpdateFocusStyle();
var x = this._x;
var y = this._y;
var key = event.keyIdentifier;
@@ -1156,7 +1156,7 @@
* @param {!Event} event
*/
CalendarPicker.prototype._handleBodyKeyDown = function(event) {
- maybeUpdateFocusStyle();
+ this.maybeUpdateFocusStyle();
var key = event.keyIdentifier;
if (key == "U+0009") {
if (!event.shiftKey && document.activeElement == global.lastFocusableControl) {
@@ -1178,11 +1178,11 @@
this.handleCancel();
}
-function maybeUpdateFocusStyle() {
- if (global.hadKeyEvent)
+CalendarPicker.prototype.maybeUpdateFocusStyle = function() {
+ if (this._hadKeyEvent)
return;
- global.hadKeyEvent = true;
- $("main").classList.remove(ClassNames.NoFocusRing);
+ this._hadKeyEvent = true;
+ this._element.classList.remove(ClassNames.NoFocusRing);
}
if (window.dialogArguments) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698