In my tests using your code I found similar results. Triggering the procedure from the Run tool in the procedure window while holding down the option key gave consistently correct results. Triggering the procedure from the Action menu while holding down the option key seemed to ignore the modifier altogether. I did notice that if you did this several times in a row that the option modifier would be recognized on a later triggering (sometimes even when the current triggering had no modifier pressed).
So, it is either a bug or modifiers are not supported in this way for the Action menu - possibly due to a conflict with Keyword Equivalents in their menu names.
I was able to make a change to get this to work with modifier keys (shift, option, etc.), however, I could not get it to work with right button clicks, it always shows leftButton no matter what button is clicked. It appears that Apple’s code is not passing that information to the application. (Clicks in the menu bar are not handled by the application, Apple’s code handles them for the application.)