Desktop: Mac Desktop App reopens window on Cmd+Tab

Created on 20 Sep 2019  Â·  7Comments  Â·  Source: mattermost/desktop

Environment

  • Mattermost Desktop: Mac version 4.2.1.62
  • macOS Mojave 10.14.6

Steps To Reproduce

  1. With the Mattermost application in focus, click the 'X' or Cmd + W to close the app window
  2. Cmd + Tab to navigate to another application
  3. Cmd + Tab to navigate back to Mattermost

Expected Behavior

Mattermost window reopens when returning to the app

Observed Behavior

Mattermost window stays closed until a selection is made from the available servers in the Window menu or the user clicks on the app icon in the dock


If you're interested please comment here and come join our "Contributors" community channel on our daily build server, where you can discuss questions with community members and the Mattermost core team. For technical advice or questions, please join our "Developers" community channel.

New contributors please see our Developer's Guide.

JIRA: https://mattermost.atlassian.net/browse/MM-18007

Help Wanted

All 7 comments

@amyblais I'd like to take this issue.

I was experimenting with globalShortcut, to no avail:

  globalShortcut.register('CommandOrControl+Tab', () => {
    if (mainWindow.isVisible()) {
      Menu.sendActionToFirstResponder('hide:');
    } else {
      mainWindow.show();
    }
  });

However, it made me realize that I was fighting against expected behavior on macOS.
This same behavior occurs for other macOS applications, both native Cocoa and other Electron-based.

I will open a PR shortly which seems to achieve what has been requested in JIRA ticket, but do we for certain want to implement behavior that goes against the expected platform behavior?
Curious to know more about customer's issue and how they are using the desktop app.

@deanwhillier Can you help with this?

@hunterlester, I would have to agree with your assessment, none of the apps I just tried automatically open a window when tabbing back to them if there is no window already open. I'm experiencing the exact same behaviour with the Desktop App so IMO this is not something that should need to be fixed.

@esethna, @andrewbrown00, thoughts from PM and UX perspective?

@esethna @deanwhillier @hunterlester this is generally the expected behavior and is the native behavior for macOS with most of the native apps.

I'm 5/5 this is a bad experience and is very frustrating for me. When I ⌘ Tab to navigate and switch apps I expect the I app select to open, even if I've previously closed the app window using ⌘ W. It bugs me to have to go manually click the App in the dock, use another short like ⌘ 0-9 if applicable, or use Spotlight to open the app window.

Check out Discord which handles it the way I feel it should work. I'm open and curious to hearing others feedback on this.

Thanks @andrewbrown00! Though I've gotten used to using keyboard shortcuts to re-open windows in this kind of situation, I also find it annoying to have to do so regardless of the default Mac behaviour.

So I guess the question is, can we reliably do so in a manner that doesn't disrupt and/or lesson the experience in some other way? @hunterlester, I haven't taken a super close look at your PR yet, but would you say that we could appropriately re-open a closed window of a still-running app whenever it re-gains focus? Would your current app.hide() approach have any negative side effects as far as expected behaviour on a mac is concerned, or is the end user experience effectively the same as actually closing the window and manually re-opening it?

@andrewbrown00 Thank you for that input. Nice to see that Discord implemented the same behavior.
@deanwhillier So far it appears to be a reliable solution. I've been trying to manually QA various cases, such as window management with Mission Control and pad gestures, closing a window in full-screen, etc, and so far I'm not seeing the behavior conflict with other expectations.

The case where app.hide() would be an issue is if we allowed customers to open multiple windows. In the case of multiple open windows, closing just one would effectively close all other windows. But not the case for us. Same for Discord, which doesn't allow multiple windows.

Okay, thanks @hunterlester! I'll take a closer look now and give it a test drive!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jasonblais picture jasonblais  Â·  5Comments

mcarthur-cpt picture mcarthur-cpt  Â·  6Comments

zetaab picture zetaab  Â·  5Comments

nerfologist picture nerfologist  Â·  7Comments

DanShockley picture DanShockley  Â·  6Comments