I have a small popup that launches when I click a Load button. The popup is just a dropdown and a button. If I select a value from the list in the dropbox, then click the load button, the popup will close and send the value I chose to the main page. That's all great, but I'm trying to speed up interaction with this popup. I have self.focus() on the dropdown's onStartup event script so that you can just use the arrow keys to select a value. I want to improve speed even more.
So the default behavior is that if I press Enter when selecting an option in the dropdown, the dropdown menu will close and set that option as the value. Good so far. But then if I hit Enter again, it doesn't now press Load. I could use the onActionPerformed event to set focus to the Load button, but then you couldn't still use the arrow keys to select until you manually move focus back to the dropdown.
What I want is to instead have the normal behavior if the box is open (Enter closes the box and selects the chosen value), but if the box is already closed, an onKeyDown event will perform the same function the Load button does. Thing is, I cannot see how to detect if the dropdown is currently opened. I've read some other topics on this forum, but they aren't helpful. I'm hoping a more specific question here will help.
Here's what it looks like when the dropdown is open and when it's closed. Pretty standard.

