morgan pushed to branch tor-browser-128.1.0esr-14.0-1 at The Tor Project / Applications / Tor Browser
Commits:
-
7b9fe534
by Henry Wilkes at 2024-08-15T19:03:15+00:00
1 changed file:
Changes:
| ... | ... | @@ -107,11 +107,12 @@ var DownloadsPanel = { |
| 107 | 107 | if (Services.prefs.getBoolPref(PREF_SHOW_DOWNLOAD_WARNING)) {
|
| 108 | 108 | torWarningMessage.hidden = false;
|
| 109 | 109 | } else {
|
| 110 | - // Re-assign focus if it is about to be lost.
|
|
| 111 | - if (torWarningMessage.contains(document.activeElement)) {
|
|
| 110 | + const hadFocus = torWarningMessage.contains(document.activeElement);
|
|
| 111 | + torWarningMessage.hidden = true;
|
|
| 112 | + // Re-assign focus that was lost.
|
|
| 113 | + if (hadFocus) {
|
|
| 112 | 114 | this._focusPanel(true);
|
| 113 | 115 | }
|
| 114 | - torWarningMessage.hidden = true;
|
|
| 115 | 116 | }
|
| 116 | 117 | };
|
| 117 | 118 | Services.prefs.addObserver(
|
| ... | ... | @@ -577,6 +578,20 @@ var DownloadsPanel = { |
| 577 | 578 | if (this._preventFocusRing) {
|
| 578 | 579 | focusOptions.focusVisible = false;
|
| 579 | 580 | }
|
| 581 | + |
|
| 582 | + // Focus the "Got it" button if it is visible.
|
|
| 583 | + // This should ensure that the alert is read aloud by Orca when the
|
|
| 584 | + // downloads panel is opened. See tor-browser#42642.
|
|
| 585 | + const torWarningMessage = document.getElementById(
|
|
| 586 | + "downloadsPanelTorWarning"
|
|
| 587 | + );
|
|
| 588 | + if (!torWarningMessage.hidden) {
|
|
| 589 | + torWarningMessage
|
|
| 590 | + .querySelector(".downloads-tor-warning-dismiss-button")
|
|
| 591 | + .focus(focusOptions);
|
|
| 592 | + return;
|
|
| 593 | + }
|
|
| 594 | + |
|
| 580 | 595 | if (DownloadsView.richListBox.itemCount > 0) {
|
| 581 | 596 | if (DownloadsView.canChangeSelectedItem) {
|
| 582 | 597 | DownloadsView.richListBox.selectedIndex = 0;
|