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

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>64160</bug_id>
          
          <creation_ts>2011-07-08 05:16:39 -0700</creation_ts>
          <short_desc>Foward a non-bubbling event to related shadow host elements across relevant shadow scopes.</short_desc>
          <delta_ts>2011-08-18 21:55:41 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>DOM</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</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>59805</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Hayato Ito">hayato</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>dglazkov</cc>
    
    <cc>dominicc</cc>
    
    <cc>morrita</cc>
    
    <cc>rolandsteiner</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>434008</commentid>
    <comment_count>0</comment_count>
    <who name="Hayato Ito">hayato</who>
    <bug_when>2011-07-08 05:16:39 -0700</bug_when>
    <thetext>Let me explain using the following example:

Document
  Component-A
    Component-B
      Component-C
      Component-D
        Input-E (* new-focused-node)
    Component-F
      Input-G
      Component-H
        Input-I
      Component-J
        Input-K (* old-focused-node)

&apos;Component&apos; here means a focusable shadow host element.
Suppose that a focused node has just been changed from &apos;Input-K&apos; to &apos;Input-E&apos;. 

In this case, which components should receive a &apos;focus&apos; event? Remember that a &apos;focus&apos; event is a non-bubbling event.

It seems that XBL2 spec says a boundary element should receive a &apos;focus&apos; event if a focusable element underneath get focused.
- http://dev.w3.org/2006/xbl2/#the-focus-domfocusin-blur-and-domfocusou

My initial rough idea is:

 * B and D (and Input-E) should receive a &apos;focus&apos; event.
 * F and J (and Input-K) should receive a &apos;blur&apos; event.
 * Each event should be fired as in a Event Target phase, which means:
   - event.target is always same to the element itself.
     e.g. A focus event listener on Component B will receive a event whose target is set to &apos;Component-B&apos;.
   - event.stopPropagation() doesn&apos;t take an effect. That doesn&apos;t make sense.

Although I use a &apos;focus&apos; event as an example, I guess we can apply the same discussion to all non-bubbling events.
Any opinion are welcome.


I referred to these documents.
- http://dev.w3.org/2006/xbl2/#event-handlers
- http://wiki.whatwg.org/wiki/Component_Model_Use_Cases#Focus_and_Shadow_Subtrees
- http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-eventgroupings-htmlevents</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>434014</commentid>
    <comment_count>1</comment_count>
    <who name="Hayato Ito">hayato</who>
    <bug_when>2011-07-08 05:29:23 -0700</bug_when>
    <thetext>If we should treat a &apos;component&apos; like a &apos;iframe&apos;, we don&apos;t need to do anything in the mentioned case.
All we have to do is just calling &apos;focus&apos; event on &apos;Input-E&apos; and calling &apos;blur&apos; event on &apos;Input-K&apos;. That&apos;s all.

But I don&apos;t think we can treat a &apos;Component&apos; and a &apos;iframe&apos; in the same fashion in this case.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>434104</commentid>
    <comment_count>2</comment_count>
    <who name="Dimitri Glazkov (Google)">dglazkov</who>
    <bug_when>2011-07-08 09:31:24 -0700</bug_when>
    <thetext>(In reply to comment #0)
&gt; Let me explain using the following example:
&gt; 
&gt; Document
&gt;   Component-A
&gt;     Component-B
&gt;       Component-C
&gt;       Component-D
&gt;         Input-E (* new-focused-node)
&gt;     Component-F
&gt;       Input-G
&gt;       Component-H
&gt;         Input-I
&gt;       Component-J
&gt;         Input-K (* old-focused-node)
&gt; 
&gt; &apos;Component&apos; here means a focusable shadow host element.
&gt; Suppose that a focused node has just been changed from &apos;Input-K&apos; to &apos;Input-E&apos;. 
&gt; 
&gt; In this case, which components should receive a &apos;focus&apos; event? Remember that a &apos;focus&apos; event is a non-bubbling event.
&gt; 
&gt; It seems that XBL2 spec says a boundary element should receive a &apos;focus&apos; event if a focusable element underneath get focused.
&gt; - http://dev.w3.org/2006/xbl2/#the-focus-domfocusin-blur-and-domfocusou

Where exactly does it say that? Focus event doesn&apos;t bubble, but it still propagates through the ancestor chain during capture.

&gt; 
&gt; My initial rough idea is:
&gt; 
&gt;  * B and D (and Input-E) should receive a &apos;focus&apos; event.

Why would B and D need to to get a focus event? Can you explain this a bit more? In my mind, only Input-E should be getting it.

&gt;  * F and J (and Input-K) should receive a &apos;blur&apos; event.

Similarly, only Input-K should be getting it.

&gt;  * Each event should be fired as in a Event Target phase, which means:
&gt;    - event.target is always same to the element itself.
&gt;      e.g. A focus event listener on Component B will receive a event whose target is set to &apos;Component-B&apos;.
&gt;    - event.stopPropagation() doesn&apos;t take an effect. That doesn&apos;t make sense.
&gt; 
&gt; Although I use a &apos;focus&apos; event as an example, I guess we can apply the same discussion to all non-bubbling events.

I don&apos;t understand why we need to re-fire non-bubbling events. Can you explain your thinking a bit more?

&gt; Any opinion are welcome.
&gt; 
&gt; 
&gt; I referred to these documents.
&gt; - http://dev.w3.org/2006/xbl2/#event-handlers
&gt; - http://wiki.whatwg.org/wiki/Component_Model_Use_Cases#Focus_and_Shadow_Subtrees
&gt; - http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-eventgroupings-htmlevents</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>434657</commentid>
    <comment_count>3</comment_count>
    <who name="Hayato Ito">hayato</who>
    <bug_when>2011-07-10 19:57:11 -0700</bug_when>
    <thetext>Hi, Dominic

Thank you for the comment.

Okay, let me explain the rationale behind.
Suppose the current &lt;input type=&quot;file&quot;&gt; element, which might be implemented as a &apos;Component&apos;, which has one internal &apos;button&apos; element.
If we focus the internal button, the outside host element, &lt;input&gt;, get &apos;focus&apos; event in a TARGET phase in the current implementation, which uses a custom logic, I guess.

So far, so good.

Suppose further that this internal button itself is implemnted as another &apos;Component&apos;. Say:

  Component-A &lt;Input type=&apos;file&apos;&gt;
   Component-B (Button)
    Internal element C (something internal)

If we try to focus this Component-A by &lt;tab&gt; key, should Component-A receive a &apos;focus&apos; event as TARGET phase?

I agree that we should fire &apos;focus&apos; event only on Internal element C in TARGET phase. That makes implementation much simpler.
If Component-A really want to know it is &apos;focused&apos;, it should use &apos;focusin&apos; event or add listener on capturing phase.

But we have to fire a &apos;focus&apos; event on Component-A as TARGET phase in this case to keep an compatibility.
So I am in a annoying situation. I don&apos;t want to make exceptional rules to each components.

I prefer a simple and general rule. If you have any idea, that&apos;s highly welcome.



(In reply to comment #2)
&gt; (In reply to comment #0)
&gt; &gt; Let me explain using the following example:
&gt; &gt; 
&gt; &gt; Document
&gt; &gt;   Component-A
&gt; &gt;     Component-B
&gt; &gt;       Component-C
&gt; &gt;       Component-D
&gt; &gt;         Input-E (* new-focused-node)
&gt; &gt;     Component-F
&gt; &gt;       Input-G
&gt; &gt;       Component-H
&gt; &gt;         Input-I
&gt; &gt;       Component-J
&gt; &gt;         Input-K (* old-focused-node)
&gt; &gt; 
&gt; &gt; &apos;Component&apos; here means a focusable shadow host element.
&gt; &gt; Suppose that a focused node has just been changed from &apos;Input-K&apos; to &apos;Input-E&apos;. 
&gt; &gt; 
&gt; &gt; In this case, which components should receive a &apos;focus&apos; event? Remember that a &apos;focus&apos; event is a non-bubbling event.
&gt; &gt; 
&gt; &gt; It seems that XBL2 spec says a boundary element should receive a &apos;focus&apos; event if a focusable element underneath get focused.
&gt; &gt; - http://dev.w3.org/2006/xbl2/#the-focus-domfocusin-blur-and-domfocusou
&gt; 
&gt; Where exactly does it say that? Focus event doesn&apos;t bubble, but it still propagates through the ancestor chain during capture.
&gt; 
&gt; &gt; 
&gt; &gt; My initial rough idea is:
&gt; &gt; 
&gt; &gt;  * B and D (and Input-E) should receive a &apos;focus&apos; event.
&gt; 
&gt; Why would B and D need to to get a focus event? Can you explain this a bit more? In my mind, only Input-E should be getting it.
&gt; 
&gt; &gt;  * F and J (and Input-K) should receive a &apos;blur&apos; event.
&gt; 
&gt; Similarly, only Input-K should be getting it.
&gt; 
&gt; &gt;  * Each event should be fired as in a Event Target phase, which means:
&gt; &gt;    - event.target is always same to the element itself.
&gt; &gt;      e.g. A focus event listener on Component B will receive a event whose target is set to &apos;Component-B&apos;.
&gt; &gt;    - event.stopPropagation() doesn&apos;t take an effect. That doesn&apos;t make sense.
&gt; &gt; 
&gt; &gt; Although I use a &apos;focus&apos; event as an example, I guess we can apply the same discussion to all non-bubbling events.
&gt; 
&gt; I don&apos;t understand why we need to re-fire non-bubbling events. Can you explain your thinking a bit more?
&gt; 
&gt; &gt; Any opinion are welcome.
&gt; &gt; 
&gt; &gt; 
&gt; &gt; I referred to these documents.
&gt; &gt; - http://dev.w3.org/2006/xbl2/#event-handlers
&gt; &gt; - http://wiki.whatwg.org/wiki/Component_Model_Use_Cases#Focus_and_Shadow_Subtrees
&gt; &gt; - http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-eventgroupings-htmlevents</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>434659</commentid>
    <comment_count>4</comment_count>
    <who name="Hayato Ito">hayato</who>
    <bug_when>2011-07-10 20:14:02 -0700</bug_when>
    <thetext>My facing problem is a &lt;keygen&gt; element, which has one internal select element.
In current implementation, if we focus that using &lt;tab&gt; key, only internal select element get &apos;focus&apos; event on TARGET phase. A &lt;kengen&gt; element itself won&apos;t get &apos;focus&apos; event on TARGET phase. That doesn&apos;t look natural to me. I&apos;d like to solve the issue without making any exceptional rules.

But I am thinking that my initial idea is too radical and complex. I am not sure that&apos;s worth implementing... Maybe we should have better approach.


(In reply to comment #3)
&gt; Hi, Dominic
&gt; 
&gt; Thank you for the comment.
&gt; 
&gt; Okay, let me explain the rationale behind.
&gt; Suppose the current &lt;input type=&quot;file&quot;&gt; element, which might be implemented as a &apos;Component&apos;, which has one internal &apos;button&apos; element.
&gt; If we focus the internal button, the outside host element, &lt;input&gt;, get &apos;focus&apos; event in a TARGET phase in the current implementation, which uses a custom logic, I guess.
&gt; 
&gt; So far, so good.
&gt; 
&gt; Suppose further that this internal button itself is implemnted as another &apos;Component&apos;. Say:
&gt; 
&gt;   Component-A &lt;Input type=&apos;file&apos;&gt;
&gt;    Component-B (Button)
&gt;     Internal element C (something internal)
&gt; 
&gt; If we try to focus this Component-A by &lt;tab&gt; key, should Component-A receive a &apos;focus&apos; event as TARGET phase?
&gt; 
&gt; I agree that we should fire &apos;focus&apos; event only on Internal element C in TARGET phase. That makes implementation much simpler.
&gt; If Component-A really want to know it is &apos;focused&apos;, it should use &apos;focusin&apos; event or add listener on capturing phase.
&gt; 
&gt; But we have to fire a &apos;focus&apos; event on Component-A as TARGET phase in this case to keep an compatibility.
&gt; So I am in a annoying situation. I don&apos;t want to make exceptional rules to each components.
&gt; 
&gt; I prefer a simple and general rule. If you have any idea, that&apos;s highly welcome.
&gt; 
&gt; 
&gt; 
&gt; (In reply to comment #2)
&gt; &gt; (In reply to comment #0)
&gt; &gt; &gt; Let me explain using the following example:
&gt; &gt; &gt; 
&gt; &gt; &gt; Document
&gt; &gt; &gt;   Component-A
&gt; &gt; &gt;     Component-B
&gt; &gt; &gt;       Component-C
&gt; &gt; &gt;       Component-D
&gt; &gt; &gt;         Input-E (* new-focused-node)
&gt; &gt; &gt;     Component-F
&gt; &gt; &gt;       Input-G
&gt; &gt; &gt;       Component-H
&gt; &gt; &gt;         Input-I
&gt; &gt; &gt;       Component-J
&gt; &gt; &gt;         Input-K (* old-focused-node)
&gt; &gt; &gt; 
&gt; &gt; &gt; &apos;Component&apos; here means a focusable shadow host element.
&gt; &gt; &gt; Suppose that a focused node has just been changed from &apos;Input-K&apos; to &apos;Input-E&apos;. 
&gt; &gt; &gt; 
&gt; &gt; &gt; In this case, which components should receive a &apos;focus&apos; event? Remember that a &apos;focus&apos; event is a non-bubbling event.
&gt; &gt; &gt; 
&gt; &gt; &gt; It seems that XBL2 spec says a boundary element should receive a &apos;focus&apos; event if a focusable element underneath get focused.
&gt; &gt; &gt; - http://dev.w3.org/2006/xbl2/#the-focus-domfocusin-blur-and-domfocusou
&gt; &gt; 
&gt; &gt; Where exactly does it say that? Focus event doesn&apos;t bubble, but it still propagates through the ancestor chain during capture.
&gt; &gt; 
&gt; &gt; &gt; 
&gt; &gt; &gt; My initial rough idea is:
&gt; &gt; &gt; 
&gt; &gt; &gt;  * B and D (and Input-E) should receive a &apos;focus&apos; event.
&gt; &gt; 
&gt; &gt; Why would B and D need to to get a focus event? Can you explain this a bit more? In my mind, only Input-E should be getting it.
&gt; &gt; 
&gt; &gt; &gt;  * F and J (and Input-K) should receive a &apos;blur&apos; event.
&gt; &gt; 
&gt; &gt; Similarly, only Input-K should be getting it.
&gt; &gt; 
&gt; &gt; &gt;  * Each event should be fired as in a Event Target phase, which means:
&gt; &gt; &gt;    - event.target is always same to the element itself.
&gt; &gt; &gt;      e.g. A focus event listener on Component B will receive a event whose target is set to &apos;Component-B&apos;.
&gt; &gt; &gt;    - event.stopPropagation() doesn&apos;t take an effect. That doesn&apos;t make sense.
&gt; &gt; &gt; 
&gt; &gt; &gt; Although I use a &apos;focus&apos; event as an example, I guess we can apply the same discussion to all non-bubbling events.
&gt; &gt; 
&gt; &gt; I don&apos;t understand why we need to re-fire non-bubbling events. Can you explain your thinking a bit more?
&gt; &gt; 
&gt; &gt; &gt; Any opinion are welcome.
&gt; &gt; &gt; 
&gt; &gt; &gt; 
&gt; &gt; &gt; I referred to these documents.
&gt; &gt; &gt; - http://dev.w3.org/2006/xbl2/#event-handlers
&gt; &gt; &gt; - http://wiki.whatwg.org/wiki/Component_Model_Use_Cases#Focus_and_Shadow_Subtrees
&gt; &gt; &gt; - http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-eventgroupings-htmlevents</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>434994</commentid>
    <comment_count>5</comment_count>
    <who name="Dimitri Glazkov (Google)">dglazkov</who>
    <bug_when>2011-07-11 10:41:57 -0700</bug_when>
    <thetext>(In reply to comment #4)
&gt; My facing problem is a &lt;keygen&gt; element, which has one internal select element.
&gt; In current implementation, if we focus that using &lt;tab&gt; key, only internal select element get &apos;focus&apos; event on TARGET phase. A &lt;kengen&gt; element itself won&apos;t get &apos;focus&apos; event on TARGET phase. That doesn&apos;t look natural to me. I&apos;d like to solve the issue without making any exceptional rules.
&gt; 
&gt; But I am thinking that my initial idea is too radical and complex. I am not sure that&apos;s worth implementing... Maybe we should have better approach.

No, I think you&apos;re onto something. The keygen and input[type=file] as implemented today demonstrate, that event retargeting is not always enough for non-bubbling events, specifically the focus/blur events.

However, we should understand what this means. Does this mean that all non-bubbling events should start acting as focus/blur on keygen? It seems that would be odd.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>435474</commentid>
    <comment_count>6</comment_count>
    <who name="Hayato Ito">hayato</who>
    <bug_when>2011-07-11 21:35:26 -0700</bug_when>
    <thetext>Hi Dimitri,

I feel the subject of this bugzilla entry is scaring. I should have focused only on a &apos;focus&apos; event, not all non-bubbling events.
It might not be a good idea to try to handle all non-bubbling event equally in this early stage.

Let me concentrate on a &apos;focus&apos; event, forgetting other non-bubbling events.


(In reply to comment #5)
&gt; (In reply to comment #4)
&gt; &gt; My facing problem is a &lt;keygen&gt; element, which has one internal select element.
&gt; &gt; In current implementation, if we focus that using &lt;tab&gt; key, only internal select element get &apos;focus&apos; event on TARGET phase. A &lt;kengen&gt; element itself won&apos;t get &apos;focus&apos; event on TARGET phase. That doesn&apos;t look natural to me. I&apos;d like to solve the issue without making any exceptional rules.
&gt; &gt; 
&gt; &gt; But I am thinking that my initial idea is too radical and complex. I am not sure that&apos;s worth implementing... Maybe we should have better approach.
&gt; 
&gt; No, I think you&apos;re onto something. The keygen and input[type=file] as implemented today demonstrate, that event retargeting is not always enough for non-bubbling events, specifically the focus/blur events.
&gt; 
&gt; However, we should understand what this means. Does this mean that all non-bubbling events should start acting as focus/blur on keygen? It seems that would be odd.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>453631</commentid>
    <comment_count>7</comment_count>
    <who name="Hayato Ito">hayato</who>
    <bug_when>2011-08-18 21:55:41 -0700</bug_when>
    <thetext>I&apos;d like to make this &apos;WONTFIX&apos; until we have a significant need for this idea,</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>