<?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>15969</bug_id>
          
          <creation_ts>2012-02-13 07:07:02 +0000</creation_ts>
          <short_desc>[Shadow]: Document.activeElement should be mentioned.</short_desc>
          <delta_ts>2012-02-20 09:47:06 +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>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>14978</blocked>
    
    <blocked>15967</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Morrita Hajime">morrita</reporter>
          <assigned_to name="Dimitri Glazkov">dglazkov</assigned_to>
          <cc>dominicc</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>64016</commentid>
    <comment_count>0</comment_count>
    <who name="Morrita Hajime">morrita</who>
    <bug_when>2012-02-13 07:07:02 +0000</bug_when>
    <thetext>This may be more implementation-like than for this standard but...
Docuent.activeElement should return null when the focus is inside 
- a shadow
- a frame in a shadow.

Feel free just to close this if this is out of the standard scope.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>64020</commentid>
    <comment_count>1</comment_count>
    <who name="Dominic Cooney">dominicc</who>
    <bug_when>2012-02-13 08:08:40 +0000</bug_when>
    <thetext>Should it return null, or should it be &quot;retargeted&quot; to the outermost host?

Is there a design principle that anytime one of these DOM attributes/methods is modified to make sense for shadows, that the API should be replicated on the ShadowRoot to provide &quot;scoped&quot; semantics?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>64023</commentid>
    <comment_count>2</comment_count>
    <who name="Morrita Hajime">morrita</who>
    <bug_when>2012-02-13 09:06:34 +0000</bug_when>
    <thetext>(In reply to comment #1)
&gt; Should it return null, or should it be &quot;retargeted&quot; to the outermost host?
I think returning null is reasonable because there are few usecases which can use
scoped activeElement. For example, we cannot click() to activate it. we cannot executeCommand() it.
etc.

&gt; 
&gt; Is there a design principle that anytime one of these DOM attributes/methods is
&gt; modified to make sense for shadows, that the API should be replicated on the
&gt; ShadowRoot to provide &quot;scoped&quot; semantics?
Good point. I hope we could minimize the # of API.
So most of &quot;short-hand&quot; type API like named getter won&apos;t be replicated.
For activeElement(), maybe we need this because there is no alternative way to expose the fact.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>64059</commentid>
    <comment_count>3</comment_count>
    <who name="Dominic Cooney">dominicc</who>
    <bug_when>2012-02-14 00:46:05 +0000</bug_when>
    <thetext>(In reply to comment #2)
&gt; (In reply to comment #1)
&gt; &gt; Should it return null, or should it be &quot;retargeted&quot; to the outermost host?
&gt; I think returning null is reasonable because there are few usecases which can
&gt; use
&gt; scoped activeElement. For example, we cannot click() to activate it. we cannot
&gt; executeCommand() it.
&gt; etc.

But consider how activeElement works when the focus is inside an iframe--the activeElement of the outer document is the iframe. Focus inside shadow should work the same way.

&gt; I hope we could minimize the # of API.

I think consistency should be the goal. I think we should try to use this standard:

If I move a chunk of markup from the document into a ShadowRoot, does the code continue to work, as long as I replace document. with s. where s is a reference to the containing shadow root?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>64062</commentid>
    <comment_count>4</comment_count>
    <who name="Morrita Hajime">morrita</who>
    <bug_when>2012-02-14 04:03:03 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt; (In reply to comment #2)
&gt; &gt; (In reply to comment #1)
&gt; &gt; &gt; Should it return null, or should it be &quot;retargeted&quot; to the outermost host?
&gt; &gt; I think returning null is reasonable because there are few usecases which can
&gt; &gt; use
&gt; &gt; scoped activeElement. For example, we cannot click() to activate it. we cannot
&gt; &gt; executeCommand() it.
&gt; &gt; etc.
&gt; 
&gt; But consider how activeElement works when the focus is inside an iframe--the
&gt; activeElement of the outer document is the iframe. Focus inside shadow should
&gt; work the same way.
That&apos;s true.

&gt; 
&gt; &gt; I hope we could minimize the # of API.
&gt; 
&gt; I think consistency should be the goal. I think we should try to use this
&gt; standard:
&gt; 
&gt; If I move a chunk of markup from the document into a ShadowRoot, does the code
&gt; continue to work, as long as I replace document. with s. where s is a reference
&gt; to the containing shadow root?
&gt;
OK. We need to investigate Document.idl to triage APIs to pick.
Just to clarify: we are not going to allow simple s/document/s/ replacement
but require developers to pick one of these two instead, right?
For example, Do we need ShadowRoot::createElement() ? My understanding is no.
But the naive understanding of the check above says yes.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>64191</commentid>
    <comment_count>5</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-02-16 21:15:09 +0000</bug_when>
    <thetext>Since the shadow DOM elements do participate in document focus navigation, we will indeed have situations where the document.activeElement will technically point to an element in a shadow DOM subtree.

To maintain encapsulation, we should retarget. Otherwise, the information about a focused element will be lost, and that seems inconsistent.

I like Dominic&apos;s iframe focus analogy: http://jsfiddle.net/nPLTD/

Since we retarget, we should somehow stash the actual value. I like the idea of adding an accessor on the ShadowRoot.

Will spec.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>64195</commentid>
    <comment_count>6</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-02-16 22:43:29 +0000</bug_when>
    <thetext>WDYT? http://dvcs.w3.org/hg/webcomponents/rev/5037164fd76e

As added bonus, I also made ShadowRoot receive events, since listening to events at the top of the shadow DOM subtree seems like a useful feature.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>64249</commentid>
    <comment_count>7</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-02-17 18:42:42 +0000</bug_when>
    <thetext>Please reopen if I messed up.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>64298</commentid>
    <comment_count>8</comment_count>
    <who name="Morrita Hajime">morrita</who>
    <bug_when>2012-02-20 09:47:06 +0000</bug_when>
    <thetext>Looks good. Thanks for caring.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>