If you press a Shortcut key combination, and the current form doesn't handle the shortcut, Delphi will check if the MainForm can handle the shortcut. If it can, the shortcut is triggered on an unrelated form.
Delphi will not trigger the shortcuts on any other forms, and the shortcuts will not be triggered on the MainForm if the main form is disabled (e.g. someone is showing a form modally).
When the user is interacting with one window, there is no valid reason why shortcuts should be triggered on another unrelated window. This is not how Windows works.
The Fix
Get rid of the special handling of MainForm.
Vcl.Forms.pas
function TApplication.IsShortCut(var Message: TWMKey): Boolean;
begin
Result := False;
if Assigned(FOnShortCut) then FOnShortCut(Message, Result);
{ The main form is normally disabled when child forms are shown by calling ShowModal. In that
scenario the code below does nothing. If you show a child form non-modally then the code
below is calling through to the application main form allowing it to handle the
shorcut keys. I can't see a good reason for that and it creates strange behaviour. A shortcut/accellerator
on the main form is activated from your current form instead of the one on your current form.
}
//Result := Result or (MainForm <> nil) and IsWindowEnabled(MainForm.Handle) and MainForm.IsShortCut(Message)
end;
Tested
Background
If you press a Shortcut key combination, and the current form doesn't handle the shortcut, Delphi will check if the MainForm can handle the shortcut. If it can, the shortcut is triggered on an unrelated form.
Delphi will not trigger the shortcuts on any other forms, and the shortcuts will not be triggered on the MainForm if the main form is disabled (e.g. someone is showing a form modally).
When the user is interacting with one window, there is no valid reason why shortcuts should be triggered on another unrelated window. This is not how Windows works.
The Fix
Get rid of the special handling of MainForm.
Vcl.Forms.pas