title: tabIndex doesn't make a label focusable using Tab key
body: <p>I'm trying to replace checkbox/radio inputs with icons. For this, I need to hide the original checkbox/radio. The problem is, I also want the form to properly support keyboard input, i.e. let the input remain focusable by <code>Tab</code> key and selectable using <code>Spacebar</code>. Since I'm hiding the input, it cannot be focused, so instead, I'm trying to make its <code>&lt;label&gt;</code> focusable.</p>
  
  <p><a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes#tabindex">This documentation</a> and various other sources led me to believe I can do that using <code>tabindex</code> attribute (corresponding to <code>HTMLElement.tabIndex</code> property). However, when I try to assign <code>tabindex</code> to my label, it remains as unfocused as ever, however much I try to <code>Tab</code> to it.</p>
  
  <p><strong>Why doesn't <code>tabindex</code> make the label focusable?</strong></p>
  
  <p>The following snippet demonstrates the issue. If you focus the input with your mouse and try focusing the label using <code>Tab</code>, it doesn't work (it focuses the following <code>&lt;span&gt;</code> with <code>tabindex</code> instead).</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>document.getElementById('checkbox').addEventListener('change', function (event) {
    document.getElementById('val').innerHTML = event.target.checked;
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div&gt;
    &lt;input type="text" value="input"&gt;
  &lt;/div&gt;
  &lt;div&gt;
    &lt;label tabindex="0"&gt;
      &lt;input type="checkbox" id="checkbox" style="display:none;"&gt;
      checkbox: &lt;span id="val"&gt;false&lt;/span&gt;
    &lt;/label&gt;
  &lt;/div&gt;
  &lt;span tabindex="0"&gt;span with tabindex&lt;/span&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>(The JavaScript code just allows to see that clicking on the label properly (un)checks the checkbox.)</p>