Bug 287739. All message bar buttons need mnemonics otherwise they are very difficult to discover and activate for screen reader users. Patch thanks to Peter Parente (parente@cs.unc.edu). r=mconnor, a=asa

This commit is contained in:
aaronleventhal%moonset.net 2005-07-13 18:18:47 +00:00
Родитель d9a857c0a0
Коммит 196f8df714
4 изменённых файлов: 44 добавлений и 10 удалений

Просмотреть файл

@ -32,6 +32,7 @@
# Alec Flett <alecf@netscape.com>
# Asaf Romano <mozilla.mano@sent.com>
# Jason Barnabe <jason_barnabe@fastmail.fm>
# Peter Parente <parente@cs.unc.edu>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
@ -215,8 +216,10 @@ const gPopupBlockerObserver = {
var popupCount = gBrowser.selectedBrowser.pageReport.length;
#ifdef XP_WIN
var popupButtonText = bundle_browser.getString("popupWarningButton");
var popupButtonAccesskey = bundle_browser.getString("popupWarningButton.accesskey");
#else
var popupButtonText = bundle_browser.getString("popupWarningButtonUnix");
var popupButtonAccesskey = bundle_browser.getString("popupWarningButtonUnix.accesskey");
#endif
if (popupCount > 1)
message = bundle_browser.getFormattedString("popupWarningMultiple", [brandShortName, popupCount]);
@ -224,7 +227,8 @@ const gPopupBlockerObserver = {
message = bundle_browser.getFormattedString("popupWarning", [brandShortName]);
gBrowser.showMessage(gBrowser.selectedBrowser, "chrome://browser/skin/Info.png",
message, popupButtonText, null, null, "blockedPopupOptions", "top", true);
message, popupButtonText, popupButtonAccesskey, null, null,
"blockedPopupOptions", "top", true);
}
}
else
@ -447,7 +451,7 @@ const gXPInstallObserver = {
if (browser) {
var host = browser.docShell.QueryInterface(Components.interfaces.nsIWebNavigation).currentURI.host;
var brandShortName = brandBundle.getString("brandShortName");
var iconURL, messageKey, buttonKey;
var iconURL, messageKey, buttonKey, buttonAccesskeyKey;
if (aData == "install-chrome") {
// XXXben - use regular software install warnings for now until we can
// properly differentiate themes. It's likely in fact that themes won't
@ -455,28 +459,32 @@ const gXPInstallObserver = {
iconURL = "chrome://mozapps/skin/xpinstall/xpinstallItemGeneric.png";
messageKey = "xpinstallWarning";
buttonKey = "xpinstallWarningButton";
buttonAccesskeyKey = "xpinstallWarningButton.accesskey";
}
else {
iconURL = "chrome://mozapps/skin/xpinstall/xpinstallItemGeneric.png";
messageKey = "xpinstallWarning";
buttonKey = "xpinstallWarningButton";
buttonAccesskeyKey = "xpinstallWarningButton.accesskey";
}
var messageString, buttonString;
var messageString, buttonString, buttonAccesskeyString;
if (!gPrefService.getBoolPref("xpinstall.enabled")) {
messageString = browserBundle.getFormattedString("xpinstallDisabledWarning",
[brandShortName, host]);
buttonString = browserBundle.getString("xpinstallDisabledWarningButton");
buttonKey = browserBundle.getString("xpinstallDisabledWarningButton.accesskey");
buttonAccesskeyString = browserBundle.getString("xpinstallDisabledWarningButton");
getBrowser().showMessage(browser, iconURL, messageString, buttonString,
null, "xpinstall-install-edit-prefs",
buttonAccesskeyString, null, "xpinstall-install-edit-prefs",
null, "top", false);
}
else {
messageString = browserBundle.getFormattedString(messageKey, [brandShortName, host]);
buttonString = browserBundle.getString(buttonKey);
buttonAccesskeyString = browserBundle.getString(buttonAccesskeyKey);
webNav = shell.QueryInterface(Components.interfaces.nsIWebNavigation);
getBrowser().showMessage(browser, iconURL, messageString, buttonString,
shell, "xpinstall-install-edit-permissions",
null, "top", false);
buttonAccesskeyString, shell,
"xpinstall-install-edit-permissions", null, "top", false);
}
}
break;
@ -5867,8 +5875,9 @@ missingPluginInstaller.prototype.newMissingPlugin = function(aEvent){
var bundle_browser = document.getElementById("bundle_browser");
var messageString = bundle_browser.getString("missingpluginsMessage.title");
var buttonString = bundle_browser.getString("missingpluginsMessage.button.label");
var buttonAccesskeyString = bundle_browser.getString("missingpluginsMessage.button.accesskey");
tabbrowser.showMessage(browser, iconURL, messageString, buttonString,
tabbrowser.showMessage(browser, iconURL, messageString, buttonString, buttonAccesskeyString,
"", "missing-plugin", null, "top", true);
}

Просмотреть файл

@ -62,14 +62,21 @@ mailUnreadMenuitem=Read Mail (%S new)
xpinstallWarning=To protect your computer, %S prevented this site (%S) from installing software on your computer.
xpinstallWarningButton=Edit Options...
# Accessibility Note:
# Be sure you do not choose an accesskey that is used elsewhere in the active context (e.g. main menu bar, submenu of the warning popup button)
# See http://www.mozilla.org/access/keyboard/accesskey for details
xpinstallWarningButton.accesskey=O
xpinstallDisabledWarning=Software installation is currently disabled. Click Edit Options... to enable it and try again.
xpinstallDisabledWarningButton=Edit Options...
xpinstallDisabledWarningButton.accesskey=O
themeWarning=To protect your computer, %S prevented this site (%S) from installing themes.
themeWarningButton=Edit Options...
popupWarning=%S prevented this site from opening a popup window.
popupWarningMultiple=%S prevented this site from opening %S popup windows.
popupWarningButton=Options
popupWarningButton.accesskey=O
popupWarningButtonUnix=Preferences
popupWarningButtonUnix.accesskey=P
popupAllow=Allow popups for %S
popupBlock=Block popups for %S
popupWarningDontShowFromMessage=Don't show this message when popups are blocked
@ -87,6 +94,7 @@ saveFormInformationNo=Don't Save
# missing plugin installer
missingpluginsMessage.title=Additional plugins are required to display all the media on this page.
missingpluginsMessage.button.label=Install Missing Plugins...
missingpluginsMessage.button.accesskey=I
# Sanitize
sanitizeWithPromptLabel=Sanitize %S...

Просмотреть файл

@ -22,6 +22,7 @@
-
- Contributor(s):
- Peter Annema <disttsc@bart.nl> (Original Author of <browser>)
- Peter Parente <parente@cs.unc.edu>
-
- Alternatively, the contents of this file may be used under the terms of
- either the GNU General Public License Version 2 or later (the "GPL"), or
@ -1021,14 +1022,14 @@
<property name="buttonText">
<getter>
<![CDATA[
return this._buttonElement.getAttribute("label");
return this._buttonElement.label;
]]>
</getter>
<setter>
<![CDATA[
if (val != "") {
this._buttonElement.removeAttribute("style");
this._buttonElement.setAttribute("label", val);
this._buttonElement.label = val;
}
else
this._buttonElement.setAttribute("style", "max-width: 1px; visibility: hidden;");
@ -1036,6 +1037,19 @@
]]>
</setter>
</property>
<property name="buttonAccesskey">
<getter>
<![CDATA[
return this._buttonElement.getAttribute("accesskey");
]]>
</getter>
<setter>
<![CDATA[
this._buttonElement.setAttribute("accesskey", val);
return val;
]]>
</setter>
</property>
<property name="closeButton">
<getter>
<![CDATA[

Просмотреть файл

@ -23,6 +23,7 @@
- Contributor(s):
- David Hyatt <hyatt@netscape.com> (Original Author of <tabbrowser>)
- Mike Connor <mconnor@steelgryphon.com>
- Peter Parente <parente@cs.unc.edu>
-
- Alternatively, the contents of this file may be used under the terms of
- either the GNU General Public License Version 2 or later (the "GPL"), or
@ -222,6 +223,7 @@
<parameter name="aIconURL"/>
<parameter name="aMessage"/>
<parameter name="aButtonLabel"/>
<parameter name="aButtonAccesskey"/>
<parameter name="aDocShell"/>
<parameter name="aSource"/>
<parameter name="aPopup"/>
@ -233,6 +235,7 @@
message.image = aIconURL;
message.text = aMessage;
message.buttonText = aButtonLabel;
message.buttonAccesskey = aButtonAccesskey;
message.hidden = false;
if (aSource) {
message.source = aSource;