Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a preference to toggle the sidebar opening on hover in compact mode #4792

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from

Conversation

afonsofrancof
Copy link

This addresses #3760.
I keep accidentally opening the sidebar even after a few weeks of using zen, so It would be nice to have the option of not opening the sidebar when hovering near it.
This would make it so it would only open with the keyboard shortcut to toggle compact mode.

@afonsofrancof afonsofrancof marked this pull request as draft January 31, 2025 19:16
@afonsofrancof afonsofrancof marked this pull request as ready for review January 31, 2025 19:34
@afonsofrancof
Copy link
Author

@mauro-balades have you had the time to look at this yet?
Thanks :)

@joshdonnell
Copy link

@afonsofrancof @mauro-balades

Any chance this can get looked at, would make a great edition for people who like to run in Compact made with shortcuts for toggling between tabs etc.

@luke-concannon
Copy link

Agree - I'm finding it to be the one major pain point - accidentally triggering the sidebar on hover when interacting with elements on the side of a page. I want to just be able to manage its visibility manually.

@mauro-balades
Copy link
Member

Yeah, but could everything be unified into a single statement? Or at least define the transitions in not (-pref...) for better readability? Thanks

@joshdonnell
Copy link

@afonsofrancof

I have pushed a PR to your fork, please review and if you are happy can you update this PR

@afonsofrancof
Copy link
Author

I have pushed a PR to your fork, please review and if you are happy can you update this PR

@joshdonnell

Your changes also add

{
     element: document.getElementById('zen-appcontent-navbar-container'),
     screenEdge: 'top',
}

to the array based on the condition. Shouldn't it be added regardless?

Also, maybe we should invert the condition like @mauro-balades asked.

In that case, it would be something like this

get hoverableElements() {
  return [
    ...(!Services.prefs.getBoolPref("zen.view.compact.show-sidebar-on-hover", true)
      ? []
      : [
          {
            element: this.sidebar,
            screenEdge: this.sidebarIsOnRight ? "right" : "left",
            keepHoverDuration: 100,
          },
        ]),
    {
      element: document.getElementById("zen-appcontent-navbar-container"),
      screenEdge: "top",
    },
  ];
}

Here we only use the condition on the sidebar itself.
What do you think?

@joshdonnell
Copy link

I have pushed a PR to your fork, please review and if you are happy can you update this PR

@joshdonnell

Your changes also add

{
     element: document.getElementById('zen-appcontent-navbar-container'),
     screenEdge: 'top',
}

to the array based on the condition. Shouldn't it be added regardless?

Also, maybe we should invert the condition like @mauro-balades asked.

In that case, it would be something like this

get hoverableElements() {
  return [
    ...(!Services.prefs.getBoolPref("zen.view.compact.show-sidebar-on-hover", true)
      ? []
      : [
          {
            element: this.sidebar,
            screenEdge: this.sidebarIsOnRight ? "right" : "left",
            keepHoverDuration: 100,
          },
        ]),
    {
      element: document.getElementById("zen-appcontent-navbar-container"),
      screenEdge: "top",
    },
  ];
}

Here we only use the condition on the sidebar itself. What do you think?

I have updated my PR I miss read the code so sorry for my oversight here. I have updated, however I don't think we should reverse the check as this goes against how other ternary's are working in the project

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Feb 11, 2025
@afonsofrancof afonsofrancof force-pushed the feature/open-on-hover-compact-mode branch from 65a9374 to ee0bcfc Compare February 11, 2025 13:42
@afonsofrancof
Copy link
Author

@mauro-balades
Is it better now? :)

@mauro-balades mauro-balades self-requested a review February 11, 2025 15:05
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants