Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
modcard hotkey issues (2/2): After hotkey close, non-existent card continues to receive onKeyDown events #3272
This is the second of two modcard hotkey issues. The first is in #3270.
The second issue is a long standing issue that I have been trying on and off for months to track down, and for the life of me, I just can't figure it out. When the modcard closes due to a hotkey firing ModeratorCard.close(), the card will disappear, but will somehow continue to receive onKeydown events. This only happens on hotkey. If you manually click the X on the card, it will NOT receive events. After closing a modcard with any hotkey (including ESC), if you don't click into the chat textarea, and hit a modcard hotkey, that key will be passed to the now invisible modcard. This has resulted in numerous times where I have accidentally started typing without having clicked into the textarea properly, and if what I type contains a p, b, t, etc... bad results happen.
The onClose handler in chat_moderator_card/index.js should be and is called when the card closes, and should and does set openModeratorCard to null. The onKeyDown handler is supposed to return without passing the keystroke to the card if openModeratorCard is not set, but when a hotkey is pressed per the reproduction steps above, onKeyDown is called, and openModeratorCard is somehow set to a ModeratorCard object that has the same data as the previously selected card, even though it was just set to null, and no card has been opened since. I obviously do not have a fix for this because I have no clue why its happening.