Bug 1801193 - Focus panel buttons when screenshots UI is opened. r=sfoster,cmkm

Differential Revision: https://phabricator.services.mozilla.com/D162333
This commit is contained in:
Niklas Baumgardner 2022-11-22 19:41:12 +00:00
parent 970de34535
commit 9ceb71fc14
3 changed files with 35 additions and 1 deletions

View File

@ -162,7 +162,6 @@
<panel id="screenshotsPagePanel"
type="arrow"
orient="vertical"
noautofocus="true"
norolluponanchor="true"
consumeoutsideclicks="never"
level="parent"

View File

@ -10,6 +10,7 @@ prefs =
[browser_screenshots_drag_scroll_test.js]
[browser_screenshots_drag_test.js]
[browser_screenshots_focus_test.js]
[browser_screenshots_overlay_panel_sync.js]
[browser_screenshots_page_unload.js]
[browser_screenshots_short_page_test.js]

View File

@ -0,0 +1,34 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
add_task(async function testPanelFocused() {
await BrowserTestUtils.withNewTab(
{
gBrowser,
url: TEST_PAGE,
},
async browser => {
let helper = new ScreenshotsHelper(browser);
helper.triggerUIFromToolbar();
await helper.waitForOverlay();
EventUtils.synthesizeKey("KEY_Tab");
let screenshotsButtons = gBrowser.selectedBrowser.ownerDocument
.querySelector("#screenshotsPagePanel")
.querySelector("screenshots-buttons").shadowRoot;
let focusedElement = screenshotsButtons.querySelector(".visible-page");
is(
focusedElement,
screenshotsButtons.activeElement,
"Visible button is focused"
);
}
);
});