title: Switching between radio inputs with keyboard triggers onclick event in javascript
body: <p>You can see it here: <a href="https://jsfiddle.net/vt0u2ddk/" rel="nofollow noreferrer">https://jsfiddle.net/vt0u2ddk/</a></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var items = document.getElementsByTagName('input');
  for (var i = 0; i &lt; items.length; i++) {
    items[i].onclick = function(e) {
      alert('clicked');
      console.log('clicked', e.target.value);
    };
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div id="text"&gt;
    &lt;input name="auto" value="foo" type="radio" checked&gt;foo&lt;/label&gt;
    &lt;input name="auto" value="bar" type="radio"&gt;bar&lt;/label&gt;
    &lt;input name="auto" value="ming" type="radio"&gt;ming&lt;/label&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>If you click on a radio button (not the label) first, you get an alert for a click event. If you then use the arrow keys to switch the selection of the radio list, each time a click event gets triggered. Why? I'm using my keyboard and not my mouse. Is there a explanation and/or workaround for this?</p>