Bug 1628255 - do not add a label/accesskey attribute to the button in the about:downloads and library downloads views, r=mconley,flod,fluent-reviewers

As noted by Jamie, accessible labels for richlistitem elements come from the
label elements that have value attributes within them.

In bug 1608202, we accidentally reused the same fluent message for the buttons
in about:downloads and the library download view (DownloadsViewUI.jsm) and
the context menuitems that do the same thing. This meant that
those menuitems gained a tooltip they shouldn't have, and the buttons gained
a label and accesskey they shouldn't have. The latter caused the
accessibility regression described in the bug.

This patch separates out the two usecases for the same string. I also checked
the other l10nIds used in DownloadsViewUI.jsm, and as far as I can tell this
is the only one that is reused in this way.

Differential Revision: https://phabricator.services.mozilla.com/D70219

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Gijs Kruitbosch 2020-04-08 21:39:14 +00:00
Родитель 29d2fbb9a4
Коммит 1e1ef247f3
5 изменённых файлов: 43 добавлений и 16 удалений

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

@ -11,10 +11,6 @@
var EXPORTED_SYMBOLS = ["DownloadsViewUI"];
const { AppConstants } = ChromeUtils.import(
"resource://gre/modules/AppConstants.jsm"
);
const { XPCOMUtils } = ChromeUtils.import(
"resource://gre/modules/XPCOMUtils.jsm"
);
@ -47,10 +43,7 @@ var gDownloadElementButtons = {
},
show: {
commandName: "downloadsCmd_show",
l10nId:
AppConstants.platform == "macosx"
? "downloads-cmd-show-mac"
: "downloads-cmd-show",
l10nId: "downloads-cmd-show-button",
descriptionL10nId: "downloads-cmd-show-description",
panelL10nId: "downloads-cmd-show-panel",
iconClass: "downloadIconShow",

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

@ -20,9 +20,9 @@
<menuitem command="downloadsCmd_show"
class="downloadShowMenuItem"
#ifdef XP_MACOSX
data-l10n-id="downloads-cmd-show-mac"
data-l10n-id="downloads-cmd-show-menuitem-mac"
#else
data-l10n-id="downloads-cmd-show"
data-l10n-id="downloads-cmd-show-menuitem"
#endif
/>

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

@ -70,9 +70,9 @@
<menuitem command="downloadsCmd_show"
class="downloadShowMenuItem"
#ifdef XP_MACOSX
data-l10n-id="downloads-cmd-show-mac"
data-l10n-id="downloads-cmd-show-menuitem-mac"
#else
data-l10n-id="downloads-cmd-show"
data-l10n-id="downloads-cmd-show-menuitem"
#endif
/>

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

@ -31,17 +31,21 @@ downloads-cmd-cancel-panel =
.aria-label = Cancel
# This message is only displayed on Windows and Linux devices
downloads-cmd-show =
downloads-cmd-show-menuitem =
.label = Open Containing Folder
.tooltiptext = { downloads-cmd-show.label }
.accesskey = F
# This message is only displayed on macOS devices
downloads-cmd-show-mac =
downloads-cmd-show-menuitem-mac =
.label = Show In Finder
.tooltiptext = { downloads-cmd-show-mac.label }
.accesskey = F
downloads-cmd-show-button =
.tooltiptext = { PLATFORM() ->
[macos] Show In Finder
*[other] Open Containing Folder
}
downloads-cmd-show-panel =
.aria-label = { PLATFORM() ->
[macos] Show In Finder

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

@ -0,0 +1,30 @@
# coding=utf8
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
from __future__ import absolute_import
from fluent.migrate.helpers import transforms_from
def migrate(ctx):
"""Bug 1628255 - fix mistaken label attribute on buttons in download views, part {index}."""
ctx.add_transforms(
"browser/browser/downloads.ftl",
"browser/browser/downloads.ftl",
transforms_from("""
downloads-cmd-show-menuitem =
.label = { COPY_PATTERN(from_path, "downloads-cmd-show.label") }
.accesskey = { COPY_PATTERN(from_path, "downloads-cmd-show.accesskey") }
downloads-cmd-show-menuitem-mac =
.label = { COPY_PATTERN(from_path, "downloads-cmd-show-mac.label") }
.accesskey = { COPY_PATTERN(from_path, "downloads-cmd-show-mac.accesskey") }
downloads-cmd-show-button =
.tooltiptext = { PLATFORM() ->
[macos] { COPY_PATTERN(from_path, "downloads-cmd-show-mac.label") }
*[other] { COPY_PATTERN(from_path, "downloads-cmd-show.label") }
}
""", from_path="browser/browser/downloads.ftl"))