Open and close a widget with one key?

Thats a Promoted Variable of the Widget so i can reference to remove from parent when i press Esc again after i opened it, this works i have it in my project and have no problems