Background
Due to a known bug, JavaFX applications that use a MenuBar will keep the mnemonic selected ("latched") when the user presses Alt+Tab to switch to another program. When the user returns to the JavaFX application, the framework retains the latch.
Problem
If the user then presses a letter that corresponds to the mnemonic, then the letter is consumed and that menu is opened.
This behaviour is not what users have come to expect from an application: it interrupts workflow. Rather, Alt+Tab should not put the application in a state whereby the menu can open. This is conflating Alt by itself to trigger the menu with Alt+Tab, a conceptually different operation.
Other questions seek to disable the mnemonic, but we want to clear the latch so that when the user returns to the application, pressing a letter will not trigger opening the menu.
Question
How do you instruct a JavaFX application to clear the latched mnemonics when Alt+Tab is pressed (i.e., the application focus is lost)?