Bug 1953155 - Enable expand on hover option and remove expand on hover coming soon message r=sidebar-reviewers,nsharpley

Differential Revision: https://phabricator.services.mozilla.com/D241293
This commit is contained in:
Kelly Cochrane
2025-03-18 22:03:50 +00:00
parent c7b2bd0575
commit 11a04a64b6
5 changed files with 1 additions and 74 deletions

View File

@@ -2107,7 +2107,7 @@ pref("sidebar.visibility", "always-show");
// as a backup to restore the sidebar UI state when a user has PPB mode on
// or has history cleared on browser close.
pref("sidebar.backupState", "{}");
pref("sidebar.expandOnHover", false);
pref("sidebar.expandOnHover", true);
pref("sidebar.old-sidebar.has-used", false);
pref("sidebar.new-sidebar.has-used", false);

View File

@@ -14,14 +14,6 @@
}
}
.setting-message {
/* Pull the message-bar over the input box's border */
margin-block-end: calc(-1 * var(--sidebar-box-border-width));
margin-inline: calc(-1 * var(--space-medium) - var(--sidebar-box-border-width));
/* Remove the top radius, match the bottom radius to the input box's radius */
--message-bar-border-radius: 0 0 var(--border-radius-medium) var(--border-radius-medium);
}
.medium-top-margin {
margin-block-start: var(--space-medium);
}

View File

@@ -22,8 +22,6 @@ const VISIBILITY_SETTING_PREF = "sidebar.visibility";
const EXPAND_ON_HOVER_PREF = "sidebar.expandOnHover";
const POSITION_SETTING_PREF = "sidebar.position_start";
const TAB_DIRECTION_SETTING_PREF = "sidebar.verticalTabs";
const EXPAND_ON_HOVER_MESSAGE_DISMISSED_PREF =
"sidebar.expandOnHoverMessage.dismissed";
export class SidebarCustomize extends SidebarPage {
constructor() {
@@ -251,26 +249,6 @@ export class SidebarCustomize extends SidebarPage {
</div>`;
}
expandOnHoverMessageTemplate() {
if (
!Services.prefs.getBoolPref(EXPAND_ON_HOVER_MESSAGE_DISMISSED_PREF, false)
) {
return html`
<moz-message-bar
class="setting-message expand-on-hover-message"
data-l10n-id="expand-on-hover-message"
@message-bar:user-dismissed=${this.onExpandOnHoverMessageDismissed}
dismissable
></moz-message-bar>
`;
}
return "";
}
onExpandOnHoverMessageDismissed() {
Services.prefs.setBoolPref(EXPAND_ON_HOVER_MESSAGE_DISMISSED_PREF, true);
}
render() {
let extensions = this.getWindow().SidebarController.getExtensions();
return html`
@@ -322,7 +300,6 @@ export class SidebarCustomize extends SidebarPage {
`
)}
</moz-checkbox>
${this.expandOnHoverMessageTemplate()}
</moz-fieldset>
<moz-fieldset class="customize-group medium-top-margin no-label">
<moz-checkbox

View File

@@ -362,42 +362,3 @@ add_task(async function test_settings_synchronized_across_windows() {
SidebarController.hide();
await BrowserTestUtils.closeWindow(newWindow);
});
add_task(async function test_expand_on_hover_message() {
await SpecialPowers.pushPrefEnv({
set: [["sidebar.expandOnHoverMessage.dismissed", false]],
});
let win = await BrowserTestUtils.openNewBrowserWindow();
let panel = await showCustomizePanel(win);
let expandOnHoverMessage = panel.shadowRoot.querySelector(
".expand-on-hover-message"
);
ok(expandOnHoverMessage, "Found the expand on hover message");
ok(expandOnHoverMessage.isConnected, "Message bar is connected");
let messageBarRemoved = BrowserTestUtils.waitForEvent(
expandOnHoverMessage,
"message-bar:close"
);
ok(expandOnHoverMessage.closeButton, "close button exists");
EventUtils.synthesizeMouseAtCenter(
expandOnHoverMessage.closeButton,
{},
win.SidebarController.browser.contentWindow
);
await messageBarRemoved;
ok(!expandOnHoverMessage.isConnected, "Message bar was removed");
// Close the window, make a new one to check that the message is not shown
await BrowserTestUtils.closeWindow(win);
win = await BrowserTestUtils.openNewBrowserWindow();
panel = await showCustomizePanel(win);
expandOnHoverMessage = panel.shadowRoot.querySelector(
".expand-on-hover-message"
);
ok(!expandOnHoverMessage, "Expand on hover message is not shown");
await BrowserTestUtils.closeWindow(win);
});

View File

@@ -65,9 +65,6 @@ sidebar-show-on-the-left =
# hovers over it.
expand-sidebar-on-hover =
.label = Expand sidebar on hover
expand-on-hover-message =
.heading = Expand on hover coming soon
.message = In a future update, youll be able to expand the sidebar on hover.
## Labels for sidebar context menu items