Refactor sidebar expanded on-hover functionality and fix sidebar expand/collapse behavior

- **Preferences**:
  - Added a new preference `zen.view.sidebar-expanded.on-hover.paused-for-expand` to manage the paused state of the sidebar hover functionality.
  - Updated `zen.view.sidebar-expanded.on-hover` preference handling to ensure proper behavior when toggling the sidebar.

- **ZenUIManager.mjs**:
  - Updated `_updateOnHoverVerticalTabs` method to handle the expanded state and remove hover attributes when the sidebar is expanded.
  - Refactored `_updateEvent` method to check and handle the expanded state of the sidebar, and to open or close the sidebar accordingly.
  - Added `openSidebar` and `closeSidebar` methods to manage the sidebar's expanded state and related attributes.
  - Refactored `toggleExpand` method to handle the new `paused-for-expand` preference and ensure proper toggling of the sidebar's expanded state.

- **zen-settings.js**:
  - Updated `setCompactModeStyle` method to handle the new `paused-for-expand` preference.
  - Ensured that the `paused-for-expand` preference is reset when the sidebar expand strategy is changed.

- **zen-browser.js**:
  - Added the new preference `zen.view.sidebar-expanded.on-hover.paused-for-expand` with a default value of `false`.

- **Submodule Updates**:
  - Updated `l10n` submodule to the latest commit `dd93803b84f398834049a3f650536fbdbd14cbca`.
  - Updated `zen-components` submodule to the latest commit `d853fa8de4167dfd4d1289f4f15792a698c738c3-dirty`.

- **Miscellaneous**:
  - Fixed indentation issues in `ZenUIManager.mjs`.
  - Removed commented-out code in `ZenUIManager.mjs`.
  - Ensured proper formatting and alignment of code blocks.

ISSUE: #2156
This commit is contained in:
ricky
2024-10-22 22:01:05 -04:00
parent d75c797553
commit 2214ab3a17
2 changed files with 57 additions and 34 deletions

View File

@@ -591,6 +591,7 @@ var gZenLooksAndFeel = {
const form = document.getElementById('zen-expand-tabbar-strat');
const radios = form.querySelectorAll('input[type=radio]');
const onHoverPref = 'zen.view.sidebar-expanded.on-hover';
const pausedForExpandPref = 'zen.view.sidebar-expanded.on-hover.paused-for-expand';
const defaultExpandPref = 'zen.view.sidebar-expanded';
if (Services.prefs.getBoolPref(onHoverPref)) {
form.querySelector('input[value="hover"]').checked = true;
@@ -621,7 +622,7 @@ var gZenLooksAndFeel = {
case 'hover':
disableCompactTabbar();
Services.prefs.setBoolPref(onHoverPref, true);
Services.prefs.setBoolPref(defaultExpandPref, true);
Services.prefs.setBoolPref(defaultExpandPref, false);
break;
}
});