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

Cocoa Close Window shortcut is incorrect #2214

Closed
mhsmith opened this issue Nov 8, 2023 · 4 comments · Fixed by #2217
Closed

Cocoa Close Window shortcut is incorrect #2214

mhsmith opened this issue Nov 8, 2023 · 4 comments · Fixed by #2217
Labels
bug A crash or error in behavior. macOS The issue relates to Apple macOS support.

Comments

@mhsmith
Copy link
Member

mhsmith commented Nov 8, 2023

Describe the bug

It should be Cmd-W, but the capital W is being translated into Cmd-Shift-W. Close All Windows is also affected.

We should add some shortcut tests to the testbed to cover this kind of thing.

Screenshot 2023-11-08 at 18 53 55

Environment

  • Operating System: macOS
  • Python version: 3.8
  • Software versions:
@mhsmith mhsmith added bug A crash or error in behavior. macOS The issue relates to Apple macOS support. labels Nov 8, 2023
@freakboy3742
Copy link
Member

"Close" is definitely Cmd-W (seen on Numbers, Music, Maps, and Contacts); but those apps are (1) designed to be persistent (i.e, they are either document-based, or they run in the background when the window isn't present), (2) they don't have a "close all" option.

However, Safari has a "Close Window" and "Close All Windows" (also Close Tab), and the shortcut definitely includes a shift:
Screenshot 2023-11-09 at 5 50 31 am

So - I'm not sure what the right solution is here. We definitely want consistency... but consistency with what? The simple "Close" doesn't entirely make sense on a base Toga app, because the core app isn't persistent - there's no difference between "close" and "quit".

I guess another option would be to take out the "Close" altogether, except maybe for DocumentApps. Close can be synthesised by an end user, so users could add it back in if they want it - the only complication would be that the shortcut wouldn't necessarily be platform appropriate.

@HalfWhitt
Copy link
Contributor

HalfWhitt commented Nov 9, 2023

For what it's worth, there are non-persistent apps that use Cmd-w for close as well, such as Calculator, Find My, Dictionary, Clock, and Weather. I think the distinction is less persistent vs. non-persistent and more single-window vs. multi-window (or multi-tab).

@mhsmith
Copy link
Member Author

mhsmith commented Nov 9, 2023

Yes, the impression I get is that the default on macOS is for Cmd-W to close the current window, unless the app offers a tab interface, in which case it closes the current tab. Single-window apps offer both Cmd-W and Cmd-Q, but they're the same except possibly for whether they leave the app running in the background.

I don't remember seeing any app in which Cmd-W does nothing. So I'm so used to using it, that when it does nothing on Toga, it feels like a big surprise.

@freakboy3742
Copy link
Member

I hadn't made the connection that Safari's behavior is related to the tabs in the interface. On that basis, I agree that "Close (CMD-W)" is the better standard to follow here.

Interestingly, the code implementing this already explicitly mentions the discrepancy between Safari and other apps...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A crash or error in behavior. macOS The issue relates to Apple macOS support.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants