This would probably require some changes in the game engine.
Right now while you have the chat box open, pressing "Esc" key does not close it but opens the "Options - Exit - Resume" menu. However, "Esc" key does close the Inventory, Pip-boy, and Character sheet. I think it would be cool if "Esc" key closed the chat box, because I have more than once found myself facing unexpected threats while typing in the chat box, which results in unfinished sentences (or just "a") and lost time.