Hit the Shift key when that happens. You can avoid the issue by closing the chat window before bringing up the Steam overlay.