Alt-tab-macos: It seems AltTab interfers with the latest IntellIJ EAP and sometimes "shadows" keyboard shortcuts

Created on 14 Oct 2020  ยท  7Comments  ยท  Source: lwouis/alt-tab-macos

Describe the bug

This will not be easy to describe ๐Ÿ˜„

Basically, I started to having issues with PhpStorm in that sometimes I would perform keyboard interaction and suddenly PhpStorm would not accept any keypress anymore.

I was already about to open a bug at https://youtrack.jetbrains.com/ _but_ during writing the report there I did more analysis and suddenly I found out I don't have this problem when I quit AltTab ๐Ÿ˜ข

To me, it's 100% reproducible with "PhpStorm 2020.3 EAP Build #PS-203.4449.24, built on October 8, 2020" and AltTab 6.7.3 (I just updated it to verify)

What the gif below shows:

  • I press my custom 2nd keystroke command ^g b to get the list of branches
  • I select one for rename, but press escape
  • no keyboard shortcuts work anymore, not even the basic PhpStorm ones
  • When I press ^g before invoking the 2nd keystroke, a list of all available 2nd stroke options appear at the very bottom
    image
  • in case after I canceled the branch rename, only one 2nd keystroke option appears at the bottom; instead of all
    image
  • Once I quit AltTab, it works normally
  • If I did not have AltTab running in the first place, I do not experience this problem at all

Basically it looks like something is "over shadowing" the PhpStorm window. Note that for this to occur, I did not even invoke the AltTab feature. It was just started/running without ever being invoked.

๐Ÿคทโ€โ™€๏ธ

alttab_phpstorm_interferece

PS: I'm happy to also report this on YouTrack, but after by pure gut feeling I found the relation to AltTab, I decided to open it here first, thanks

bug

Most helpful comment

I found the root cause!

It has nothing to do with keyboard events, contrary to what I assumed. It's the same exotic issue I witnessed in the past with another app called Protege. Somehow, just subscribing to the accessibility events of IntelliJ EAP breaks the scenario with branch renaming. Subscribing to accessibility events (using AXObserverCreate + AXObserverAddNotification) should never affect an app. It's supposed to be passive observation for accessibility app like a screenreader, or AltTab. However somehow it affects the app in this case, and in Protege's case.

It looks like a clear bug from macOS API here. Observing an app shouldn't break it. Also it's only happening for kAXFocusedUIElementChangedNotification, not the dozen other notification types.

I'll include a workaround in the next release ๐Ÿ‘

All 7 comments

Ok, seems there's more to properly investigate here. I further found out:

  • it does not matter whether this operation is invoked via keyboard shortcut or not
  • I can do the same with just the mouse to get to the "branch rename" dialog and it triggers the same issue

I currently don't know any other way to trigger this, so so far it seems that the "branch rename" modal dialog from PhpStorm is somehow "special" here and interferes with AltTab in some way.

I could reproduce this on the latest IntelliJ IDEA EAP with no customizations whatsoever:

Thank you very much for this Sherlock Holmes investigation @mfn! I had a blast reading the intricate explanations ๐Ÿ˜„

I will try to reproduce locally and see what could be at play here. Based on the symptoms, I have no clue what it could be.

Quick question in the meanwhile: did this happen / does it happen with AltTab 6.7.2?

does it happen with AltTab 6.7.2?

Yes!

I was able to reproduce locally! At first I couldn't, on my IntelliJ, but then I installed the EAP, and there it reproduces. This seems to be exclusive to the EAP version then.

Also notable, the shortcuts are not working only when I stay focused on IntelliJ. As soon as I focus another app, and come back to IntelliJ, then they work again, without a need to quit AltTab.

I found the root cause!

It has nothing to do with keyboard events, contrary to what I assumed. It's the same exotic issue I witnessed in the past with another app called Protege. Somehow, just subscribing to the accessibility events of IntelliJ EAP breaks the scenario with branch renaming. Subscribing to accessibility events (using AXObserverCreate + AXObserverAddNotification) should never affect an app. It's supposed to be passive observation for accessibility app like a screenreader, or AltTab. However somehow it affects the app in this case, and in Protege's case.

It looks like a clear bug from macOS API here. Observing an app shouldn't break it. Also it's only happening for kAXFocusedUIElementChangedNotification, not the dozen other notification types.

I'll include a workaround in the next release ๐Ÿ‘

Confirmed, does not break anymore (also in PhpStorm), thank you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

anukul picture anukul  ยท  3Comments

valentinocossar picture valentinocossar  ยท  3Comments

boldandbusted picture boldandbusted  ยท  3Comments

mfn picture mfn  ยท  4Comments

lwouis picture lwouis  ยท  3Comments