Skip to content

Commit

Permalink
Enhance compact mode functionality by refining sidebar animation cond…
Browse files Browse the repository at this point in the history
…itions and updating CSS ignore rules
  • Loading branch information
mauro-balades committed Jan 25, 2025
1 parent d996db3 commit 63fcbc7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ docs/issue-metrics/*.md
# Some CSS files are preprocessed and prettier doesn't handle them well
# We also dont want to format the CSS files that are generated by the build
src/browser/base/content/zen-styles/zen-tabs/vertical-tabs.css
src/browser/base/content/zen-styles/zen-compact-mode.css
src/browser/base/zen-components/ZenEmojies.mjs
build/codesign/codesign.bash
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

& #zen-sidebar-top-buttons:not(:has(toolbarbutton, toolbaritem)) {
&
#zen-sidebar-top-buttons:not(
:has(#zen-sidebar-top-buttons-customization-target > *:not(#zen-sidebar-top-buttons-separator))
) {
max-height: 0 !important;
min-height: 0 !important;
opacity: 0;
Expand Down
8 changes: 6 additions & 2 deletions src/browser/base/zen-components/ZenCompactMode.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,17 @@ var gZenCompactModeManager = {
this._animating = true;
const isCompactMode = this.preference;
const canHideSidebar = Services.prefs.getBoolPref('zen.view.compact.hide-tabbar');
const canAnimate =
lazyCompactMode.COMPACT_MODE_CAN_ANIMATE_SIDEBAR &&
!this.sidebar.hasAttribute('zen-user-show') &&
!this.sidebar.hasAttribute('zen-has-hover');
// Do this so we can get the correct width ONCE compact mode styled have been applied
if (lazyCompactMode.COMPACT_MODE_CAN_ANIMATE_SIDEBAR) {
if (canAnimate) {
this.sidebar.setAttribute('animate', 'true');
}
window.requestAnimationFrame(() => {
let sidebarWidth = this.getAndApplySidebarWidth();
if (!lazyCompactMode.COMPACT_MODE_CAN_ANIMATE_SIDEBAR) {
if (!canAnimate) {
this.sidebar.removeAttribute('animate');
this._animating = false;
return;
Expand Down

0 comments on commit 63fcbc7

Please sign in to comment.