sublime_text icon indicating copy to clipboard operation
sublime_text copied to clipboard

Disable macOS click-through on ST3 window

Open kakysha opened this issue 7 years ago • 6 comments
trafficstars

Click-through is one of the things which differs macOS from other OSs. In two words, in macOS clicking on a background window (which doesn't have focus) only makes it active, without passing the click to the window itself. So you don't accidentally make unwanted action inside the app while just trying to bring the app to foreground.

Although all other apps in macOS has it disabled, currently, ST3 window has 'click-though' feature enabled, which is against Apple guidelines:

Avoid providing click-through for an item or action whose result might be dangerous or undesirable. Specifically, avoid enabling click-through for an item that:

  • Performs a potentially harmful action that users can’t cancel (for example, the Delete button in Mail)
  • Performs an action that is difficult or impossible to cancel (such as the Send button in Mail)
  • Dismisses a dialog without telling the user what action was taken (for example, the Save button in a Save dialog that overwrites an existing file and automatically dismisses the dialog)
  • Removes the user from the current context (for example, selecting a new item in a Finder column that changes the target of the Finder window)

Last point is exactly my case, as ST3 while being in background only has it's sidebar visible, so switching from Safari to ST3 only possible by clicking files/folders in ST3 sidebar, which changes currently opened file in ST3 (= switches context).

No other apps do that, they all require two clicks to perform an action when the app was in background.

Here is one poor guy asking for the same, but on windows: https://forum.sublimetext.com/t/focus-on-click-in-windows/12575

For me, click-through works for sidebar with project files/folders, also for 'vertical tabs', which are resided above project folders, also for minimap.

click-through

kakysha avatar Feb 28 '18 16:02 kakysha

Related: https://github.com/SublimeTextIssues/Core/issues/1720 and some comments on the current support for click-through on the forums

keith-hall avatar Feb 28 '18 17:02 keith-hall

I've spent a little time looking into this, and it doesn't seem entirely clear cut what the "correct" answer is. I just tried Safari, Calendar, Messages and some third party apps I use regularly. All of them performed a click-through and selected the item I clicked on when the app was inactive.

wbond avatar Feb 27 '19 02:02 wbond

@wbond Here's how to reproduce.

Open the native Calculator app while having Finder's window open in the background. Now click on one of the items in the Finder sidebar. It won't be selected. You'll have to click on it once again to do that. Your first click just brings the Finder window to the foreground and does nothing more. This is the desired behavior for ST.

Yes you can go to a specific tab in Safari by clicking on it even if the window is in the background but you can't click any html link inside the content window right away. Since you may perform an undesired unintended action this way

Important! You should check only the native macOS apps. 3rd party ones built with Electron may have a different (incorrect) behavior.

-- From the UX standpoint an item that supports click-through ideally should also react to mouseover indicating it's ready to receive a user action. This does not happen in ST. The close tab buttons that react to mouseover in the active window don't do this in the inactive window but still react to clicks. The same goes to the sidebar items. This makes the UI confusing. You don't know what to expect from your click. Eventually you get used to it but obviously it's not ideal.

My suggestion is to leave the click-through behavior for tabs and open files but make them react to mouseover when the window is inactive and disable click-through for sidebar items and minimap.

websash avatar Feb 27 '19 10:02 websash

@websash I prefer disabling click-through for ST completely, as clicking in almost any spot in ST window will change the context I was in before leaving ST. Apple guidelines state exactly about this: * Removes the user from the current context (for example, selecting a new item in a Finder column that changes the target of the Finder window)

So clicking on open files/tabs just brings up a new file (I have tabs in sidebar btw.), instead of the file I was working on before googling, for example. I forced to press ctrl+tab every time after I return back to ST :(

kakysha avatar Feb 28 '19 12:02 kakysha

I prefer disabling click-through for ST completely, as clicking in almost any spot in ST window will change the context I was in before leaving ST.

Same here. I wish clicking in the window only raised the window and did not action anything inside the window.

I wish this Apple UI guideline was better respected (in general, many other apps violate this as well, which is unfortunate).

jamessimas avatar Nov 22 '23 20:11 jamessimas

As far as I am concerned, I wish click-though is never forbidden, and enabled everywhere. Inability to click-though on so many apps on macOS is currently a major pain that way too many users complain. Myself included, coming back recently to macOS, this is one of the first things that hit me, needing to click twice each time I switch with mouse from terminal, web, editor, etc... before being able to type some text. To the point I really wonder how long-time Mac users do, or if they even realize.

And I do not care about Apple guidelines, which is preventing everyone being efficient, only because a very few people at some time in the past clicked-though a bad button

alexfouche avatar Mar 26 '24 16:03 alexfouche

Heya, surprised I haven't thrown my hat in the ring here!

I believe it's fine to leave the current behavior - yes, even on macOS - as the default. It's just how Sublime Text has worked for ages. Applications disagree on click-through; there's no getting around it, so the default may as well be arbitrary, and left quite as it is.

However, can we pleeeeeeeeeeeeeease have a Preferences.sublime-settings option to customize this? To disable click-through, if we so desire?

Thanks <3

Edit: To be clear, I'm mainly concerned with click-through that alters the in-text cursor position, as @kakysha and @jamessimas comment on above. I could care less about clicks that e.g. preview a file because I clicked it in the sidebar, or switch to a new system tab since I've got two open in one window.

towerofnix avatar Dec 28 '24 00:12 towerofnix

And I do not care about Apple guidelines, which is preventing everyone being efficient

@alexfouche that's a bit dramatic don't you think? It's just what you're used to. I prefer being able to click anywhere on the window and not have my cursor move to a different place. For me, that's more efficient as I can start typing/pasting where I left off.

Regardless of our own opinions, adding an option to disable it hurts no one.

wtfloris avatar Jan 22 '25 09:01 wtfloris

I feel like this changed, yet this discussion implies it's always been like this. I have just noticed lately that I click in sublime and am surprised and disappointed that my cursor is NOT where it was before. Sometimes clicking a window, rather than using CMD-Tab is the easiest way to get back.

It felt so different I went searching this forum about it.

So I would love if this becomes more like Mac OS (I tried Safari and click through is NOT happening as far as I can tell) but I would also be content with a setting to chose the behavior.

I see BenjaminSchaaf assigned this to himself 3 weeks ago, so I have high hopes something is happening. But again, I am really surprised this is a long term issue. Somehow I never noticed these past 10 years?

canoeberry avatar Nov 14 '25 14:11 canoeberry

@canoeberry

Thanks for posting!

This is not a long standing behavior. You're not crazy. :)

I downloaded some old builds and confirmed this started happening in build 4186 of Sublime Text 4 (ST).

Build What happens
Prior to build 4186 Clicking the body of a ST4 window focuses the window without changing the cursor location.
After build 4186 Clicking the body of a ST4 window focuses the window and changes the cursor location.

As you noted, it makes it harder to use the mouse to interact with ST.

I reported this in the Discord channel, but unfortunately it didn't go anywhere.

jamessimas avatar Nov 14 '25 18:11 jamessimas

Ah - I just paid for another three years and upgraded to 4200.

Well I sure hope it gets sorted.

canoeberry avatar Nov 14 '25 18:11 canoeberry

FWIW, click-through behavior was intentionally changed in ST 4184 to satisfy a request issued by #6488.

A "click_through" setting is supported as of ST4201 to enable end users to adjust this behavior on MacOS.

deathaxe avatar Nov 14 '25 18:11 deathaxe

Oh my lord, I didn't even consider the possibility that I wasn't crazy, just assumed it as fact and thought I changed something in my workflow that suddenly made me notice this difference (and then found this thread).

Glad to hear it's configurable in 4201, thank you!

wtfloris avatar Nov 14 '25 20:11 wtfloris

FWIW, click-through behavior was intentionally changed in ST 4184 to satisfy a request issued by #6488.

A "click_through" setting is supported as of ST4201 to enable end users to adjust this behavior on MacOS.

I am so happy to hear I'll be able to configure this in 4201.

This is great news! 🎉

jamessimas avatar Nov 14 '25 22:11 jamessimas

@canoeberry @jamessimas Click-through was accidentally disabled in build 4170 and then re-enabled in build 4184. So yes click-through is the long standing behavior.

BenjaminSchaaf avatar Nov 14 '25 23:11 BenjaminSchaaf

Hooray, thank you! This is exactly the news I was hoping for, super awesome!!

towerofnix avatar Nov 15 '25 01:11 towerofnix