title: How do I make an accessible onClick handler for links in React?
body: <p>I have a link in my React application that calls an <code>onClick</code> handler as follows:</p>
  
  <pre><code>&lt;a onClick={handleClick}&gt;Link&lt;/a&gt;
  </code></pre>
  
  <p>However, since I'm not using the native <code>href</code> attribute, this handler does not get activated when I focus the link, then press <kbd>Enter</kbd>.</p>
  
  <p>Now, of course I could add an <code>onKeyDown</code> handler, then check whether the key that was pressed is <kbd>Space</kbd> or <kbd>Enter</kbd> and, if it is, call <code>handleClick</code>. However, I'm afraid that that won't be enough to capture all accessibility nuances, nor whether it will behave exactly like regular links.</p>
  
  <p>Thus, the question is: is there a way to indicate that I want my function to be called when the link is followed by whatever possible interaction method?</p>