This way, pressing escape works even if you have a link selected (which
is often the case after clicking on an anchor). We avoid processing
unwanted keydown events because they'll be default prevented.
Add "keydown" event listener to body rather than document, because it's
sufficient and for consistency.