Added logic to persist key text after panel closed