Enable Escape key to close tag suggestion popup

closes #1893
- Checking the contents of search term after evaluating the keycode caused the suggestion box to be hidden and immediately reshown
- Moving the if/else to the top of the function enables us to fix the issue without complicating the suggestion update logic
Merge pull request #1950 from Damiya/1893-fix

Enable Escape key to close tag suggestion popup