Bug 1933818 - Sidebar panel keyboard shortcuts should hide the sidebar r=sidebar-reviewers,nsharpley,jsudiaman
*Update SidebarState logic so that opening and closing panels reverts to the correct launcher visibility for the show and hide setting *Add a test Differential Revision: https://phabricator.services.mozilla.com/D231838
This commit is contained in:
@@ -27,6 +27,7 @@ export class SidebarCustomize extends SidebarPage {
|
||||
VISIBILITY_SETTING_PREF,
|
||||
"always-show"
|
||||
);
|
||||
this.boundObserve = (...args) => this.observe(...args);
|
||||
}
|
||||
|
||||
static properties = {
|
||||
@@ -47,6 +48,7 @@ export class SidebarCustomize extends SidebarPage {
|
||||
this.getWindow().addEventListener("SidebarItemAdded", this);
|
||||
this.getWindow().addEventListener("SidebarItemChanged", this);
|
||||
this.getWindow().addEventListener("SidebarItemRemoved", this);
|
||||
Services.prefs.addObserver(VISIBILITY_SETTING_PREF, this.boundObserve);
|
||||
}
|
||||
|
||||
disconnectedCallback() {
|
||||
@@ -54,6 +56,22 @@ export class SidebarCustomize extends SidebarPage {
|
||||
this.getWindow().removeEventListener("SidebarItemAdded", this);
|
||||
this.getWindow().removeEventListener("SidebarItemChanged", this);
|
||||
this.getWindow().removeEventListener("SidebarItemRemoved", this);
|
||||
Services.prefs.removeObserver(VISIBILITY_SETTING_PREF, this.boundObserve);
|
||||
}
|
||||
|
||||
observe(subject, topic, prefName) {
|
||||
switch (topic) {
|
||||
case "nsPref:changed":
|
||||
switch (prefName) {
|
||||
case VISIBILITY_SETTING_PREF:
|
||||
this.visibility = Services.prefs.getStringPref(
|
||||
VISIBILITY_SETTING_PREF,
|
||||
"always-show"
|
||||
);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
get sidebarLauncher() {
|
||||
|
||||
Reference in New Issue
Block a user