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

macOS: Add a setting to enable acceptsFirstMouse for window #24634

Closed
tracker1 opened this issue Apr 12, 2017 · 30 comments

Comments

@tracker1
Copy link

commented Apr 12, 2017

  • VSCode Version: Version 1.11.1 (1.11.1)
  • OS Version: macOS Sierra (10.12.4)

Steps to Reproduce:

  1. Open VS Code
  2. Open terminal
  3. Open a file for editing
  4. Focus on another application
  5. Click (once) on the terminal area of VS Code
  6. Start typing

You'll notice the typing is at the cursor in the editor screen, it would be really nice if the terminal area were focused for input... really annoying when copying from another application, intending to paste in the terminal area.

Apologies if this issue is already reported I did try searching in the issues area before reporting. Also, I haven't tested in Windows or Linux as to if this is an issue in other environments. It may also be an upstream issue with Electron, as I don't recall this always being the behavior.

@Tyriar

This comment has been minimized.

Copy link
Member

commented Apr 17, 2017

Works fine on Linux, this is probably a Mac issue. @alexandrudima have you come across this before?

@alber70g

This comment has been minimized.

Copy link

commented Apr 20, 2017

I've got the same on Sierra. It seems that the 'clickthrough' doesnt activate and it only activates the window. Not the click in the terminal area.

You can 'check' this with using CMD + Click, what results in activating the controls on the window, without getting focus to the window.

vscode clickthrough with cmd

@tracker1

This comment has been minimized.

Copy link
Author

commented May 11, 2017

Just curious if anyone's looked into fixing this yet? (Thanks @alber70g for the screen capture)

It's something that bites me a few times a day currently. And has to be effecting others as well. Not always the terminal, but even the right editor segment (left/right) ... usually when I click in from another window and paste... (migrating app logic from one app/repo into a mostly-rewrite in VS Code + git)

@probedb

This comment has been minimized.

Copy link

commented Aug 5, 2017

I raised a duplicate without realising it. It's annoying when I start typing commands and realise I'm typing in my code instead.

@alexandrudima

This comment has been minimized.

Copy link
Member

commented Aug 8, 2017

This appears to be a behaviour that Chrome shares on OSX.

When leaving focus on an element A, and focusing on a different window, clicking on a focusable element B focuses the Chrome window back, but in the element A. Only a second click on B will move focus to element B.

May I kindly ask that you open an issue with Chromium at https://bugs.chromium.org/p/chromium/issues/list

e.g.: (focus is left in the find input and I'm clicking in this comment box)
24634

@Tyriar

This comment has been minimized.

Copy link
Member

commented Nov 18, 2017

I just discovered the setting acceptsFirstMouse on BrowserWindow which enables this behavior when the window is clicked. See electron/electron#215

I haven't been using a mac for the longest time so I'm not sure if this should be a setting or not, but I would definitely like this behavior in the terminal, status bar, explorer, etc.

@Tyriar Tyriar assigned bpasero and unassigned alexandrudima Nov 18, 2017

@bpasero

This comment has been minimized.

Copy link
Member

commented Nov 19, 2017

Maybe a setting yeah, for sure not as default.

@lmapii

This comment has been minimized.

Copy link

commented Feb 16, 2018

second this, would be great to have as a setting. this very confusing/annoying when working with multiple windows / monitors

@tracker1

This comment has been minimized.

Copy link
Author

commented Feb 20, 2018

I'd love to see this exposed as a setting... I already change a few things in my user settings, what's one more, it's the default behavior that's particularly annoying. I use Linux, Windows and MacOS pretty regularly, and this just stands out a lot for me. I tend to use tools that work everywhere. Bash in windows (with git tooling) is the other kind of odd man out, and some of the muscle memory for hot keys too... but this focus behavior has to be the worst imho.

@monkeygroover

This comment has been minimized.

Copy link

commented Mar 6, 2018

No, in fact I cannot get that to work. cmd-click for me doesn't select anything..

@bpasero

This comment has been minimized.

Copy link
Member

commented Mar 6, 2018

@monkeygroover ah interesting, I just tried it out and Cmd+click works nicely for me. What macOS are you on?

@monkeygroover

This comment has been minimized.

Copy link

commented Mar 6, 2018

Sierra (not high). With multiple desktops (not sure if that matters or not).

So if I click in the code panel, then focus another app, if I click back on the terminal panel with cmd-click nothing happens at all.

@monkeygroover

This comment has been minimized.

Copy link

commented Mar 6, 2018

Fn-click appears to work for me.

EDIT: but not when i attempted to repro again. odd!

even so, this issue tends to happen when you aren't thinking and just clicking around, so the workaround isn't much more useful than remembering to click twice.

@tracker1

This comment has been minimized.

Copy link
Author

commented Mar 8, 2018

@monkeygroover, even if Fn+click works, I and a lot of others are using an external keyboard that has no such key.

@monkeygroover

This comment has been minimized.

Copy link

commented Mar 8, 2018

If it wasn't clear in the edit, fn+click doesn't work for me. This is all moot anyway, having to remember to press a modifier key is not a satisfactory fix as the annoyance is because single clicking doesn't work as expected (at least imho :) even if the style guide claims otherwise), not that it can't be worked around.

@bpasero

This comment has been minimized.

Copy link
Member

commented Mar 26, 2018

I am open for a PR here that is reasonably small and introduces a new macOS only setting.

@dvdsgl

This comment has been minimized.

Copy link

commented Mar 26, 2018

(Posting this comment from #46454 since it was a closed duplicate.)

I think some more subtlety may be warranted here. I mentioned counterintuitive focus behavior #46454 and this issue was referenced as a remedy but I think it may go too far and have some weird side effects for interaction.

Xcode's default behavior is to move focus to the clicked editor, even when Xcode becomes focused from the background (I mention Xcode because the rationale for Code not behaving this way is that it's not the 'default macOS behavior', which I think is not a strong enough reason given Apple's design in Xcode, and also I think it's too focused on the broader behavior enabled by this option rather than the input scenario).

2018-03-24 10 10 15

The option proposed here is fine, but it a bit of a blunt tool for addressing #46454.

@bpasero

This comment has been minimized.

Copy link
Member

commented Mar 26, 2018

@dvdsgl interesting, I was not aware that these editors would enable it by default. I would be willing to maybe enable this setting by default but having a setting to disable this seems like a good idea in case people really do not like this behaviour?

@dvdsgl

This comment has been minimized.

Copy link

commented Mar 26, 2018

@bpasero I recommend not having an option to disable, but considering it if you get any evidence that the Xcode behavior is problematic.

@bpasero

This comment has been minimized.

Copy link
Member

commented Apr 3, 2018

Let's see how it goes with this enabled by default. The setting to disable this is called window.clickThroughInactive

@tracker1

This comment has been minimized.

Copy link
Author

commented Apr 9, 2018

Next release?

@bpasero

This comment has been minimized.

Copy link
Member

commented Apr 10, 2018

You can give our preview releases a try from: https://code.visualstudio.com/insiders/

@bpasero

This comment has been minimized.

Copy link
Member

commented Apr 11, 2018

Verify (macOS):

  • open multiple windows
  • click into each window
  • the action under the mouse should execute without the need of a second click (e.g. click on a file in the explorer)
  • verify this no longer works when you configure window.clickThroughInactive: false
@monkeygroover

This comment has been minimized.

Copy link

commented Apr 11, 2018

Works great, ty.

@alber70g

This comment has been minimized.

Copy link

commented Apr 30, 2018

When will this land in the regular release?

@bpasero

This comment has been minimized.

Copy link
Member

commented Apr 30, 2018

@alber70g this week with the 1.23 release.

@tracker1

This comment has been minimized.

Copy link
Author

commented May 8, 2018

OMG, this is great... Nothing in the release notes, but so happy to see this... it affected me several times a day.

@vscodebot vscodebot bot locked and limited conversation to collaborators May 18, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.