title: Using JavaScript, how can you tell if a user is tabbing backwards?
body: <p>I've got an HTML link, and I want to take some action when the user tabs away from it - but only if the user is tabbing forwards through the document, as opposed to backwards.</p>
  
  <p>Is there a reliable cross-browser way to detect which way the user is tabbing through the document, or indeed if they're tabbing through the document at all? I'm binding to the <code>blur</code> event, but that doesn't necessarily mean that the user is tabbing.</p>
  
  <p>I've had a look at inspecting the value of <code>document.activeElement</code>, or the <code>hasFocus</code> attribute of the previous focusable element in the source, but:</p>
  
  <ol>
  <li>those seem like relatively recent additions, and thus might not be widely supported, and </li>
  <li>I'm not sure they'll be inspectable when the <code>blur</code> event fires, as even if the user is tabbing, I don't think the next element will be focused yet.</li>
  </ol>