Bug 1914452 - Update revamp sidebar button to reflect sidebar states r=sidebar-reviewers,desktop-theme-reviewers,dao,sfoster,jsudiaman

- different sidebar button icons for expanded, collapsed and hidden sidebar states
- move sidebar-button to beginning of navbar strip, to the left of back button
- update tests to reflect new sidebar button positioning

Differential Revision: https://phabricator.services.mozilla.com/D223406
This commit is contained in:
Nikki Sharpley
2024-10-02 16:52:46 +00:00
parent 0da298faa5
commit 20a153c56b
10 changed files with 146 additions and 54 deletions

View File

@@ -156,11 +156,21 @@ add_task(async function testTabStopsNoPageWithHomeButton() {
AddHomeBesideReload();
await withNewBlankTab(async function () {
startFromUrlBar();
await expectFocusAfterKey("Shift+Tab", "home-button");
if (sidebarRevampEnabled) {
await expectFocusAfterKey("Shift+Tab", "sidebar-button");
await expectFocusAfterKey("ArrowRight", "home-button");
} else {
await expectFocusAfterKey("Shift+Tab", "home-button");
}
await expectFocusAfterKey("Shift+Tab", "tabs-newtab-button");
await expectFocusAfterKey("Shift+Tab", gBrowser.selectedTab);
await expectFocusAfterKey("Tab", "tabs-newtab-button");
await expectFocusAfterKey("Tab", "home-button");
if (sidebarRevampEnabled) {
await expectFocusAfterKey("Tab", "sidebar-button");
await expectFocusAfterKey("ArrowRight", "home-button");
} else {
await expectFocusAfterKey("Tab", "home-button");
}
await expectFocusAfterKey("Tab", gURLBar.inputField);
await expectFocusAfterKey("Tab", afterUrlBarButton);
if (sidebarRevampEnabled) {
@@ -187,11 +197,21 @@ async function doTestTabStopsPageLoaded(aPageActionsVisible) {
"Shift+Tab",
"tracking-protection-icon-container"
);
await expectFocusAfterKey("Shift+Tab", "reload-button");
if (sidebarRevampEnabled) {
await expectFocusAfterKey("Shift+Tab", "sidebar-button");
await expectFocusAfterKey("ArrowRight", "reload-button");
} else {
await expectFocusAfterKey("Shift+Tab", "reload-button");
}
await expectFocusAfterKey("Shift+Tab", "tabs-newtab-button");
await expectFocusAfterKey("Shift+Tab", gBrowser.selectedTab);
await expectFocusAfterKey("Tab", "tabs-newtab-button");
await expectFocusAfterKey("Tab", "reload-button");
if (sidebarRevampEnabled) {
await expectFocusAfterKey("Tab", "sidebar-button");
await expectFocusAfterKey("ArrowRight", "reload-button");
} else {
await expectFocusAfterKey("Tab", "reload-button");
}
await expectFocusAfterKey("Tab", "tracking-protection-icon-container");
await expectFocusAfterKey("Tab", gURLBar.inputField);
await expectFocusAfterKey(
@@ -299,14 +319,11 @@ add_task(async function testTabStopNoButtons() {
resetToolbarWithoutDevEditionButtons();
AddHomeBesideReload();
if (!sidebarRevampEnabled) {
CustomizableUI.addWidgetToArea(
"sidebar-button",
"nav-bar",
CustomizableUI.getPlacementOfWidget("home-button").position + 1
);
CustomizableUI.addWidgetToArea("sidebar-button", "nav-bar", 0);
}
// Make sure the button is reachable now that it has been re-added.
await expectFocusAfterKey("Shift+Tab", "home-button", true);
await expectFocusAfterKey("Shift+Tab", "sidebar-button", true);
await expectFocusAfterKey("ArrowRight", "home-button");
RemoveHomeButton();
});
});
@@ -375,13 +392,26 @@ add_task(async function testArrowsDisabledButtons() {
"tracking-protection-icon-container"
);
// Back and Forward buttons are disabled.
await expectFocusAfterKey("Shift+Tab", "reload-button");
if (sidebarRevampEnabled) {
await expectFocusAfterKey("Shift+Tab", "sidebar-button");
await expectFocusAfterKey("ArrowRight", "reload-button");
} else {
await expectFocusAfterKey("Shift+Tab", "reload-button");
}
EventUtils.synthesizeKey("KEY_ArrowLeft");
is(
document.activeElement.id,
"reload-button",
"ArrowLeft on Reload button when prior buttons disabled does nothing"
);
if (sidebarRevampEnabled) {
is(
document.activeElement.id,
"sidebar-button",
"ArrowLeft on Reload button when prior buttons disabled navigates to sidebar-button"
);
} else {
is(
document.activeElement.id,
"reload-button",
"ArrowLeft on Reload button when prior buttons disabled does nothing"
);
}
BrowserTestUtils.startLoadingURIString(aBrowser, "https://example.com/2");
await BrowserTestUtils.browserLoaded(aBrowser);
@@ -391,7 +421,12 @@ add_task(async function testArrowsDisabledButtons() {
"Shift+Tab",
"tracking-protection-icon-container"
);
await expectFocusAfterKey("Shift+Tab", "back-button");
if (sidebarRevampEnabled) {
await expectFocusAfterKey("Shift+Tab", "sidebar-button");
await expectFocusAfterKey("ArrowRight", "back-button");
} else {
await expectFocusAfterKey("Shift+Tab", "back-button");
}
// Forward button is still disabled.
await expectFocusAfterKey("ArrowRight", "reload-button");
}