Skip to content
Snippets Groups Projects
Commit 518c72a4 authored by henry's avatar henry Committed by morgan
Browse files

fixup! Bug 40701: Add security warning when downloading a file

Bug 42642: Focus the "Got it" button when opening the downloads panel.

This should ensure that the alert is read aloud by Orca screen reader.
parent 26a9fea9
Branches
Tags
2 merge requests!1202Bug_43099: 2024 YEC Strings,!1136Bug 43085: Rebased alpha onto 128.2.0esr
......@@ -107,11 +107,12 @@ var DownloadsPanel = {
if (Services.prefs.getBoolPref(PREF_SHOW_DOWNLOAD_WARNING)) {
torWarningMessage.hidden = false;
} else {
// Re-assign focus if it is about to be lost.
if (torWarningMessage.contains(document.activeElement)) {
const hadFocus = torWarningMessage.contains(document.activeElement);
torWarningMessage.hidden = true;
// Re-assign focus that was lost.
if (hadFocus) {
this._focusPanel(true);
}
torWarningMessage.hidden = true;
}
};
Services.prefs.addObserver(
......@@ -577,6 +578,20 @@ var DownloadsPanel = {
if (this._preventFocusRing) {
focusOptions.focusVisible = false;
}
// Focus the "Got it" button if it is visible.
// This should ensure that the alert is read aloud by Orca when the
// downloads panel is opened. See tor-browser#42642.
const torWarningMessage = document.getElementById(
"downloadsPanelTorWarning"
);
if (!torWarningMessage.hidden) {
torWarningMessage
.querySelector(".downloads-tor-warning-dismiss-button")
.focus(focusOptions);
return;
}
if (DownloadsView.richListBox.itemCount > 0) {
if (DownloadsView.canChangeSelectedItem) {
DownloadsView.richListBox.selectedIndex = 0;
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment