Alt-F4 on modal (sub)dialogs

When I have a modal Juce dialog open and press Alt-F4 to dismiss it, the keystroke doesn’t do anything. The dialog has it’s own task bar button, so you’d expect an Alt-F4 to trigger a WM_CLOSE or such. Then again almost all subdialogs on windows are dismissable with Alt-F4 (save as dialogs, options dialogs, etc.).

Digging through the Juce code in juce_Win32_Windowing.cpp I saw this on the last line in HWNDComponentPeer::doKeyDown(const WPARAM key) (note: I’m using version 5.3.2):

    return used || (Component::getCurrentlyModalComponent() != nullptr);

Since there are modal dialogs open the function always returns true for every key down, and thus the Alt-F4 gets swallowed. The switch above it where VK_F4 is handled (along with all Fx keys and some more) does call handleKeyUpOrDown and handleKeyPress, but these don’t trigger a close either (in fact: Alt-F4 comes out as used = false in my app).

Needless to say that by removing the getCurrentlyModalComponent check from the return statement, the WM_CLOSE message does come in now any my modal dialogs nicely close on Alt-F4.

What are the repercussions of just deleting it? I’d assume this extra are-there-modals-open check isn’t there for nothing… so I’m 200% hesitant making this alteration.