zen-browser / desktop

🌀 Experience tranquillity while browsing the web without people tracking you!
https://zen-browser.app
Mozilla Public License 2.0
18.4k stars 449 forks source link

Sidebar hover and right click makes the sidebar dissapear #2587

Open Shamatix opened 1 week ago

Shamatix commented 1 week ago

Captchas

What happened?

If I use the following options: image image

And I right click the sidebar it closes https://i.imgur.com/Y5LoIiH.gif

There also is a more annoying thing if you hover your cursor a bit outside the window it closes the sidebar for a split second: https://i.imgur.com/dpRpt08.gif

In Arc neither is the case: https://i.imgur.com/beemw9M.gif

Makes it quite easier to use the sidebar in compact mode if it wouldn't "hide / be annoying" :p

Reproducible?

Version

Version 1.0.1-a.17 (64-bit)

What platform are you seeing the problem on?

Windows

Relevant log output

No response

dosubot[bot] commented 1 week ago

Hey there, @Shamatix! 👋 I'm here to help you with bugs, questions, and becoming a contributor. Let's squash those bugs together!

The issue you're experiencing with the sidebar disappearing when you right-click or hover slightly outside the window is related to the hover detection logic in the gZenVerticalTabsManager class. The _updateOnHoverVerticalTabs method checks the zen.view.sidebar-expanded.on-hover preference to determine whether the sidebar should be shown or hidden based on hover events.

To improve this behavior and make it more like the Arc browser, you could modify the hover detection logic to be less sensitive or require a more deliberate action to hide the sidebar. One approach is to introduce a delay before hiding the sidebar when the mouse leaves the window. Here's a potential modification to the _updateOnHoverVerticalTabs method:

_updateOnHoverVerticalTabs() {
  const onHover = Services.prefs.getBoolPref('zen.view.sidebar-expanded.on-hover');
  const expanded = Services.prefs.getBoolPref('zen.view.sidebar-expanded');
  const sidebar = this.navigatorToolbox;

  if (onHover) {
    sidebar.removeAttribute('zen-expanded');
    sidebar.setAttribute('zen-user-hover', 'true');
    sidebar.removeAttribute('zen-has-hover');

    // Introduce a delay before hiding the sidebar
    document.addEventListener('mouseleave', () => {
      setTimeout(() => {
        if (!document.getElementById('main-window').matches(':hover')) {
          sidebar.removeAttribute('zen-user-hover');
        }
      }, 500); // 500ms delay
    }, { once: true });
  } 
  else if (expanded) {
    sidebar.setAttribute('zen-expanded', 'true');
    sidebar.removeAttribute('zen-user-hover');
    sidebar.removeAttribute('zen-has-hover');
  } else {
    sidebar.removeAttribute('zen-expanded');
    sidebar.removeAttribute('zen-user-show');
    sidebar.removeAttribute('zen-user-hover');
  }
}

This modification introduces a 500ms delay before the sidebar is hidden when the mouse leaves the window, which may help reduce accidental sidebar hiding. Adjust the delay as needed to better match the desired behavior [1].

To continue talking to Dosu, mention @dosu.

matthewtapps commented 13 hours ago

I keep my tabs on the right side of the screen, and have noticed that the popup text when hovering over a specific tab also interferes with the hover, so it becomes quite difficult to navigate (especially between essential tabs which are horizontally next to each other so moving the cursor from one to the next results in the hovered tab bar closing). This doesn't appear to happen for the tab hover popup text when the tabs are on the left, though.

I am interested in trying to contribute to the Zen browser project so if anyone can point me in the right direction for addressing some of these hover issues I am keen to take a look!