Using Keyboard Navigation and SPACE to push a PushButton causes the Action to fire twice

I received an odd report from a tester this afternoon - when they clicked a PushButton to move to the next step in a Wizard UI, the UI was skipping a step. After much sweat trying to duplicate the effect here, I finally discovered that using the TAB key to navigate to the button and then using the SPACEBAR to “push” it results in the button’s Action event firing two times in very quick succession.

And, since there’s no way to determine if the push came from a mouse click or SPACEBAR, it’s not a simple one to fix.

<https://xojo.com/issue/55540>

I didn’t have a chance to check Windows or macOS, but no one else has reported this.

The quick workaround is to have a one-shot timer in the Action event that doesn’t allow the code to work unless a certain amount of time has passed.

What I’ve done is to add a boolean to the MouseDown and then clear it after the end of the first call (since the code in the Action event takes around 30ms to complete and the “pseudo-click” events occur less than 2ms apart. Testing now.