Share this question

Welcome to Teachnovice Q&A, where you can ask questions and receive answers from other members of the community.

This is a collaboratively edited question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Application Remembers that Alt Key Was Pressed after Alt+Tab Away?

0 like 0 dislike
237 views

When I use Alt+Tab to switch away from an application, then return to that application, the Alt key does not work on the first press. Here's how to reproduce

  • Open Chrome and Notepad++
  • Activate Notepad++ using any method you like
  • Alt+Tab to activate Chrome
  • Alt+Tab to activate Notepad++
  • Press the Alt key one time

The menu in Notepad++ is not activated.

This is reproducible for me using most applications. Notepad++ is the one that clued me in to what's happening, though. When I Alt+Tab away from Notepad++, I can see that the menu selectors (underlines) are visible. They remain visible even as the application is inactive and when I reactivate it. When I return to the app, the Alt key removes the menu selectors - the opposite of what I want it to do.

The only application where this doesn't happen, that I've tried so far, is SQL Server Management Studio (but I've only tried about a dozen). No matter how I activate and deactivate SSMS, the Alt key activates the menu on the first press.

It's easy to see that the menu selectors are being activated in Notepad++, but less easy in applications that use a RibbonUI, like Office. It doesn't show the Ribbon tooltips like pressing Alt alone in the application, but the effect is the same. That is, when I return to the application, I have to press Alt twice to see the tooltips.

It seems like I'm activating the menu before leaving the application, but that's not quite right. It's some weird third state. All other keys except Alt work as expected. If I activate the menu in Notepad++, then press the down arrow key, the File menu expands. But if I Alt+Tab away from Notepad++, then reactivate, the down arrow moves the cursor down one row as expected. So it's not as if Alt is necessarily persisting such that a down arrow would still expand the menu.

I want to Alt+Tab away from Excel, Alt+Tab back to Excel, press Alt+A+C, and not have AC appear in the active cell.

asked Oct 17, 2016 by dkusleika  

@dkusleika - My first guess is the "Key Down" event is caught by Excel but that the app switcher catches the "Key Up" so Excel never gets the memo.

My take on the issue is that this is unavoidable. Alt-down is sent to the application, then Tab-down gets handled by Windows and switches the focus away. Alt-up is never sent. The rest is just the internal bookkeeping of the application and how it handles the sequence of Alt-down/Focus-out/Focus-in.

Thanks for the comments. If I'm in Excel and hold down Alt (keydown, no keyup) I see the tooltips on the Ribbon. But if I Alt+Tab, no tooltips. If Excel was getting the keydown and nothing else, wouldn't the tooltips still appear? Also note that holding down Alt does not show the tooltips immediately. In Notepad++, the keydown activates the menu. In Chrome, keyup activates the menu. So maybe Office accounts for no keyup after a wait. Unfortunately, I'm just going to have to train myself to live with it. Shouldn't take more than a year or so.

Excel might be intelligent enough after a focus-out to undo the Alt-down. Notepad++ maybe not. From your testing it seems that most applications don't handle this case.

It's not reproducible for me at none of mentioned apps. all of them behavior in normal way. can you mention your windows versions etc ? mine is :Windows 10 Enterprise x64, Version 1511, OS Build 10586.420 on MSI CX61 2QC laptop, keyboard PC/AT Enhanced PS/2 keyboard (101/102=Keys)

1 Answer

0 like 0 dislike
My take on the issue is that this is unavoidable :

Alt-down is sent to the application, then Tab-down gets handled by Windows which switches the focus away. The result is that Alt-up is never sent, so the application menu stays int Alt-pressed mode. When you now do Alt-Tab and give the application back the focus, the first Alt you press just undoes the Menu mode.

The rest is just the internal bookkeeping of the application and how it handles the sequence of Alt-down/Focus-out/Focus-in. Some applications might be intelligent enough to after a focus-out to undo the Alt-down. From your testing it seems that most applications don't handle this case.
answered Oct 17, 2016 by harrymc  
...