confirmWithTab didn't provide accesskey for buttons (fix for https://github.com/piroor/treestyletab/issues#issue/43 )

This commit is contained in:
Piro / SHIMODA Hiroshi 2011-02-10 08:19:49 +09:00
parent 68e4690da8
commit e8cba54fd5

View File

@ -1,7 +1,7 @@
/** /**
* @fileOverview Tab Related Confirimation Library for Firefox 3.5 or later * @fileOverview Tab Related Confirimation Library for Firefox 3.5 or later
* @author SHIMODA "Piro" Hiroshi * @author SHIMODA "Piro" Hiroshi
* @version 1 * @version 3
* *
* @license * @license
* The MIT License, Copyright (c) 2010-2011 SHIMODA "Piro" Hiroshi * The MIT License, Copyright (c) 2010-2011 SHIMODA "Piro" Hiroshi
@ -34,7 +34,7 @@ if (typeof namespace.Deferred == 'undefined')
var confirmWithTab; var confirmWithTab;
(function() { (function() {
const currentRevision = 2; const currentRevision = 3;
var loadedRevision = 'confirmWithTab' in namespace ? var loadedRevision = 'confirmWithTab' in namespace ?
namespace.confirmWithTab.revision : namespace.confirmWithTab.revision :
@ -62,11 +62,15 @@ var confirmWithTab;
box.PRIORITY_INFO_MEDIUM box.PRIORITY_INFO_MEDIUM
), ),
aOptions.buttons.map(function(aLabel, aIndex) { aOptions.buttons.map(function(aLabel, aIndex) {
var accessKey = aLabel.charAt(0);
if (!/[0-9a-z]/i.test(accessKey))
accessKey = aIndex+1;
return { return {
label : aLabel, label : aLabel,
callback : function() { callback : function() {
deferred.call(aIndex); deferred.call(aIndex);
} },
accessKey : accessKey
}; };
}) })
); );