<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>24106</bug_id>
          
          <creation_ts>2013-12-16 05:27:18 +0000</creation_ts>
          <short_desc>FKA: No defined way to get keyboard focus into and out of a shadow DOM component</short_desc>
          <delta_ts>2015-07-06 08:06:03 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>HISTORICAL - Component Model</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>MOVED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>a11y, a11ytf</keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>23870</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Silvia Pfeiffer">silviapfeiffer1</reporter>
          <assigned_to name="Dimitri Glazkov">dglazkov</assigned_to>
          <cc>dglazkov</cc>
    
    <cc>faulkner.steve</cc>
    
    <cc>hayato</cc>
    
    <cc>ian</cc>
    
    <cc>jcraig</cc>
    
    <cc>lwatson</cc>
    
    <cc>mike</cc>
    
    <cc>public-html-admin</cc>
    
    <cc>public-html-wg-issue-tracking</cc>
    
    <cc>public-webapps</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>97637</commentid>
    <comment_count>0</comment_count>
    <who name="Silvia Pfeiffer">silviapfeiffer1</who>
    <bug_when>2013-12-16 05:27:18 +0000</bug_when>
    <thetext>+++ This bug was initially created as a clone of Bug #23870 +++

FKA (full keyboard access): There is currently no defined way to get keyboard focus into and out of a shadow DOM component. Some components (like the native &quot;number&quot; input type) don&apos;t need this, but others (like native video controls) need multiple tab stops inside the shadow DOM component.

For example: 

&lt;input type=&quot;number&quot;&gt; 

Although there are multiple focusable elements inside (textfield, increment button, and decrement button), all features can be controlled with standard keyboard behavior. Focus stops on the input, and the increment/decrement buttons are activate with up/down arrows.


&lt;video controls&gt;

There are multiple controls in the shadow DOM component, including volume/mute buttons/sliders, a playback position slider, a cc toggle button and subtitle picker menu, etc. There is currently no consistent way to control HTML 5 media elements without using a mouse. 

I suggest that the specs provide a way for a web component to declare whether it has a focusable sub-DOM, which should be the default for &lt;video&gt; and &lt;audio&gt; sub-DOMs, and probably some input types like date and color.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97686</commentid>
    <comment_count>1</comment_count>
    <who name="James Craig">jcraig</who>
    <bug_when>2013-12-16 19:54:30 +0000</bug_when>
    <thetext>Please note the follow-up discussion and example in Bug #23870</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97692</commentid>
    <comment_count>2</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-12-16 21:55:46 +0000</bug_when>
    <thetext>Why doesn&apos;t this just work if the shadow DOM has focusable controls? I don&apos;t understand what change to the HTML spec would address this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97694</commentid>
    <comment_count>3</comment_count>
    <who name="James Craig">jcraig</who>
    <bug_when>2013-12-16 22:01:30 +0000</bug_when>
    <thetext>(In reply to Ian &apos;Hixie&apos; Hickson from comment #2)
&gt; Why doesn&apos;t this just work if the shadow DOM has focusable controls? I don&apos;t
&gt; understand what change to the HTML spec would address this.

If that is the expected behavior, it may be enough, but the HTML/DomComponents specs don&apos;t say one way or the other, and implementations are currently different.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97696</commentid>
    <comment_count>4</comment_count>
    <who name="James Craig">jcraig</who>
    <bug_when>2013-12-16 22:04:08 +0000</bug_when>
    <thetext>It should also specify what happens when an author specifies tabindex=&quot;-1&quot; on an element that has focusable controls. Does this prevent the focusable descendants from being focused in the shadow DOM tree as well?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97718</commentid>
    <comment_count>5</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-12-16 23:24:43 +0000</bug_when>
    <thetext>Yeah, good question, tabindex=&quot;1&quot; also -- does the bound element get focused and then after a tab, the inner elements?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97722</commentid>
    <comment_count>6</comment_count>
    <who name="James Craig">jcraig</who>
    <bug_when>2013-12-16 23:46:35 +0000</bug_when>
    <thetext>That&apos;s not (In reply to Ian &apos;Hixie&apos; Hickson from comment #5)
&gt; Yeah, good question, tabindex=&quot;1&quot; also -- does the bound element get focused
&gt; and then after a tab, the inner elements?

That&apos;s the behavior I&apos;d expect after tabindex=&quot;0&quot;, but not necessarily after tabindex=&quot;1&quot;; but it&apos;s certainly something to think about in the context of bug 23960.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97770</commentid>
    <comment_count>7</comment_count>
    <who name="Hayato Ito">hayato</who>
    <bug_when>2013-12-18 08:41:51 +0000</bug_when>
    <thetext>(In reply to James Craig from comment #4)
&gt; It should also specify what happens when an author specifies tabindex=&quot;-1&quot;
&gt; on an element that has focusable controls. Does this prevent the focusable
&gt; descendants from being focused in the shadow DOM tree as well?

Regarding with Web Components, even when the shadow host has &apos;tabindex=-1&apos;, focusable elements in its shadow tree can be focusable and can be traversed by &apos;tab&apos; key.

&apos;8.2 Focus Navigation&apos; in Shadow DOM spec defines sequential focus navigation order:
&gt; http://w3c.github.io/webcomponents/spec/shadow/#focus-navigation</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97786</commentid>
    <comment_count>8</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-12-18 18:18:31 +0000</bug_when>
    <thetext>So is there nothing to do here?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97797</commentid>
    <comment_count>9</comment_count>
    <who name="Hayato Ito">hayato</who>
    <bug_when>2013-12-19 04:39:11 +0000</bug_when>
    <thetext>(In reply to Ian &apos;Hixie&apos; Hickson from comment #8)
&gt; So is there nothing to do here?

I think so.

However I guess there is a *gap* between native elements and user-made Web components.

Some native elements might use a shadow tree in its implementation, such as &lt;video&gt; element or &lt;input&gt; elements in Chrome. But we can&apos;t assume that these elements are implemented by Shadow DOM.

If these elements have &apos;tabindex=-1&apos;, I think there is no spec which defines the behavior of focusable elements inside of native elements.

We can&apos;t apply the Shadow DOM spec into these native elements unless we can assume that these are implemented in Shadow DOM.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97933</commentid>
    <comment_count>10</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-01-02 20:42:14 +0000</bug_when>
    <thetext>The issue of defining how default bindings work is a separate bug. (Feel free to file that bug, though it can&apos;t really get resolved until Web Components are firmly established; it&apos;s on my radar in any case).

Separate from that, though, I don&apos;t understand what needs to be done to resolve this bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99515</commentid>
    <comment_count>11</comment_count>
    <who name="James Craig">jcraig</who>
    <bug_when>2014-01-31 00:39:58 +0000</bug_when>
    <thetext>The only lacking part I see now is that the spec does not address how a parent document can prevent the focusability of elements inside a shadow DOM. For example, shadow DOM implementations of &lt;input type=&quot;date&quot;&gt; will likely include several focusable elements (a popup dialog with menus, buttons, etc), whether natively focusable or by adding tabindex=&quot;0&quot;. If an author explicitly disallows focusability on the element by one of these methods:

&lt;input type=&quot;date&quot; disabled&gt;
&lt;input type=&quot;date&quot; tabindex=&quot;-1&quot;&gt;

...then I believe the sub-level shadow DOM elements should inherit the non-focusability of the shadow host.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99525</commentid>
    <comment_count>12</comment_count>
    <who name="Hayato Ito">hayato</who>
    <bug_when>2014-01-31 05:02:47 +0000</bug_when>
    <thetext>(In reply to James Craig from comment #11)
&gt; The only lacking part I see now is that the spec does not address how a
&gt; parent document can prevent the focusability of elements inside a shadow
&gt; DOM. For example, shadow DOM implementations of &lt;input type=&quot;date&quot;&gt; will
&gt; likely include several focusable elements (a popup dialog with menus,
&gt; buttons, etc), whether natively focusable or by adding tabindex=&quot;0&quot;. If an
&gt; author explicitly disallows focusability on the element by one of these
&gt; methods:
&gt; 
&gt; &lt;input type=&quot;date&quot; disabled&gt;
&gt; &lt;input type=&quot;date&quot; tabindex=&quot;-1&quot;&gt;
&gt; 
&gt; ...then I believe the sub-level shadow DOM elements should inherit the
&gt; non-focusability of the shadow host.

That makes sense.

I thought it should be addressed several times when I&apos;ve updated the relevant spec. However, I haven&apos;t done yet because I&apos;ve not heard strong requirements for that.

In my opinion, we should have a power to *skip* entire sub-trees.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100043</commentid>
    <comment_count>13</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-02-07 18:20:40 +0000</bug_when>
    <thetext>This is an issue for the shadow DOM spec, no?

I mean, presumably the shadow DOM spec needs controls to handle focus on its bound element, since I see several options:
 - the bound element having focus really means some element in the shadow tree
   has focus (e.g. &lt;input&gt;)
 - the bound element having focus is separate from any subcomponent having focus
   (e.g. &lt;video tabindex=1&gt;)
 - the bound element can never have focus (e.g. &lt;col&gt;)
 - the bound element should be able to prevent subparts from having focus (e.g.
   &lt;input tabindex=-1&gt;)

All of these need to be handled by the shadow tree, they&apos;re not something HTML can define as far as I can tell.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100057</commentid>
    <comment_count>14</comment_count>
    <who name="James Craig">jcraig</who>
    <bug_when>2014-02-07 20:48:25 +0000</bug_when>
    <thetext>(In reply to Ian &apos;Hixie&apos; Hickson from comment #13)
&gt; This is an issue for the shadow DOM spec, no?
&gt; ...
&gt; All of these need to be handled by the shadow tree, they&apos;re not something
&gt; HTML can define as far as I can tell.

@tabindex is specific to HTML, whereas Shadow DOM is more general, so there are probably still edits for both specs.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100073</commentid>
    <comment_count>15</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-02-07 23:47:14 +0000</bug_when>
    <thetext>So... what edits should be done to HTML?

I don&apos;t know what I can do to resolve this bug at this point.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100096</commentid>
    <comment_count>16</comment_count>
    <who name="Hayato Ito">hayato</who>
    <bug_when>2014-02-10 04:35:06 +0000</bug_when>
    <thetext>I am okay to move this issue to Shadow DOM spec&apos;s issue for now.
That sounds reasonable to me.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100250</commentid>
    <comment_count>17</comment_count>
    <who name="James Craig">jcraig</who>
    <bug_when>2014-02-11 07:23:08 +0000</bug_when>
    <thetext>(In reply to Ian &apos;Hixie&apos; Hickson from comment #15)
&gt; So... what edits should be done to HTML?
&gt; 
&gt; I don&apos;t know what I can do to resolve this bug at this point.

There are some sketched ideas here regarding tabindex scoping (proposed @tabwrap, @tabtarget, @tabwrapper) that could be applied generally and as default values to existing cases like shadow DOM components and frames.

https://github.com/bmeck/fm.js/wiki

My point about doing this in HTML is that the shadow DOM spec could generally state that focus could move into focusable controls contained in the shadow DOM of a &apos;focusable shadow root&apos; but HTML is the spec to define what constitutes the focusable shadow root, no? 

This is spread out over several other bugs now (bug 23475, bug 23871, more) that it&apos;s getting hard to track them all together. It&apos;s possible those other bugs will sufficiently cover the edits that need to be made.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>121651</commentid>
    <comment_count>18</comment_count>
    <who name="Hayato Ito">hayato</who>
    <bug_when>2015-07-06 08:06:03 +0000</bug_when>
    <thetext>Moved to https://github.com/w3c/webcomponents/issues/228</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>