How to deselect text with the ESC key in any application?

In vim, the ESC key deselects any selected text. I would like to implement this same behavior in other applications (especially browsers).