DireKrow suggested on Discord a workaround of opening the dialogs when the keys are released rather than when they're pressed. This workaround is implemented in commit e875712. However, I'd still like to arrange a proper solution at some point, as this merely mitigates the issue rather than actually fixing it.