Simple toggle not working

public GameObject canvasInstr;
private bool instr = false;

void Start () {
        canvasInstr.SetActive(false);
}
        
void Update () {

        if(Input.GetKeyDown(KeyCode.I) && !canvasInstr){
        canvasInstr.SetActive(true);
        instr = true;
        }
        else if(Input.GetKeyDown(KeyCode.I) && canvasInstr){
        canvasInstr.SetActive(false);
        instr = false;
        }
}

I really don’t know what I am doing wrong , however this toggle only switch itself off once and never goes back on.
Please help
(Maybe has to do with the fact that I have 2 canvas with diffeent names?)
Many thanks in advance!

The code !canvasInstr is the most likely problem. canvasInstr is an object, not a boolean, objects are often computed as true if not null and false if null, since the object is not null it will always equate to true and thus it will always run the else condition. I think you meant to use !instr instead.