<?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>14427</bug_id>
          
          <creation_ts>2011-10-11 11:37:25 +0000</creation_ts>
          <short_desc>Investigate if click()&apos;s click-in-progress should apply to user and/or script initiated clicks</short_desc>
          <delta_ts>2011-11-04 17:39:47 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>HTML WG</product>
          <component>HTML5 spec</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</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>
          <dependson>14471</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Olli Pettay">bugs</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>annevk</cc>
    
    <cc>bzbarsky</cc>
    
    <cc>ian</cc>
    
    <cc>mike</cc>
    
    <cc>public-html-admin</cc>
    
    <cc>public-html-wg-issue-tracking</cc>
          
          <qa_contact name="HTML WG Bugzilla archive list">public-html-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>58043</commentid>
    <comment_count>0</comment_count>
    <who name="Olli Pettay">bugs</who>
    <bug_when>2011-10-11 11:37:25 +0000</bug_when>
    <thetext>Currently if user clicks &lt;a href=&quot;http://www.w3c.org&quot; target=&quot;_blank&quot; onclick=&quot;this.click()&quot;&gt;foo&lt;/a&gt;
that will per spec open two new browsing contexts.
That is how Gecko works.

IE9 and Opera have different behavior. They seems to set click-in-progress flag
also when user clicks. But they don&apos;t handle that in the same way.
https://bugzilla.mozilla.org/show_bug.cgi?id=679566#c17
IE sets the flag only to event target, Opera also to ancestors, or something like that.

IE&apos;s behavior is very error prone, so either the spec should stay as it is, or
it should follow what Opera does.

(Webkit doesn&apos;t have a.click())</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>58044</commentid>
    <comment_count>1</comment_count>
    <who name="Olli Pettay">bugs</who>
    <bug_when>2011-10-11 11:43:14 +0000</bug_when>
    <thetext>If the spec is changed, it should be defined if script initiated event
(document.createEvent(&quot;mouseevent&quot;), .initMouseEvent(...), dispatchEvent) should
set the flag.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>58206</commentid>
    <comment_count>2</comment_count>
    <who name="Olli Pettay">bugs</who>
    <bug_when>2011-10-13 23:15:22 +0000</bug_when>
    <thetext>Actually IE&apos;s behavior could be the right one. Script should be able to
initiate some other click, and even in the same event target chain as the
original one. It is just that the same event target shouldn&apos;t be triggered.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>58241</commentid>
    <comment_count>3</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-10-14 18:36:58 +0000</bug_when>
    <thetext>Per the spec, there&apos;ll be only one window open, but the reason is a bit weird: it&apos;s because the event fired for the click() method is not trusted, so that window is popup-blocked (popups in the spec are only allowed if all the current click events are trusted). The &apos;onclick&apos; event handler does trigger twice; the second time it triggers, the click() method does nothing, because the element&apos;s click-in-progress flag is set.

As far as I can tell, what the spec says here seems reasonable.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>58242</commentid>
    <comment_count>4</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2011-10-14 18:39:36 +0000</bug_when>
    <thetext>&gt; popups in the spec are only allowed if all the current click events are trusted

Why?  This makes it so that a user triggering a keyboard event that calls click() to open a popup would fail.  Is that web-compatible?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>58248</commentid>
    <comment_count>5</comment_count>
    <who name="Olli Pettay">bugs</who>
    <bug_when>2011-10-14 19:18:08 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt; Per the spec, there&apos;ll be only one window open, but the reason is a bit weird:
&gt; it&apos;s because the event fired for the click() method is not trusted, so that
&gt; window is popup-blocked (popups in the spec are only allowed if all the current
&gt; click events are trusted).
That makes no sense.

I&apos;ll file a spec bug about that.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>58795</commentid>
    <comment_count>6</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-10-24 23:22:56 +0000</bug_when>
    <thetext>Keyboard events can directly cause the link to be followed (hitting enter triggers a trusted click event). I don&apos;t mind changing this stuff, it&apos;s not been carefully reviewed as far as I know. In any case, I&apos;ll address this in bug 14471.

As far as this bug is concerned, I don&apos;t see anything that needs to change. Any objections to closing the bug?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59023</commentid>
    <comment_count>7</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-10-26 23:30:18 +0000</bug_when>
    <thetext>EDITOR&apos;S RESPONSE: This is an Editor&apos;s Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Rejected
Change Description: no spec change
Rationale: see comment 6</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59063</commentid>
    <comment_count>8</comment_count>
    <who name="Olli Pettay">bugs</who>
    <bug_when>2011-10-27 10:16:03 +0000</bug_when>
    <thetext>(In reply to comment #6)
&gt; Keyboard events can directly cause the link to be followed (hitting enter
&gt; triggers a trusted click event). I don&apos;t mind changing this stuff, it&apos;s not
&gt; been carefully reviewed as far as I know. In any case, I&apos;ll address this in bug
&gt; 14471.
&gt; 
&gt; As far as this bug is concerned, I don&apos;t see anything that needs to change. Any
&gt; objections to closing the bug?

It is just that there are apparently some scripts which end up
calling .click() in the element which user activated.
IE and Opera open the link just once, but per spec it should be opened twice.
Gecko follows the spec and that has lead to at least one bug in Mozilla&apos;s
bugzilla.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59145</commentid>
    <comment_count>9</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-10-28 19:46:15 +0000</bug_when>
    <thetext>Ah, that&apos;s good to know. Ok. What would you like the spec to say, then? You describe IE&apos;s behaviour as &quot;error-prone&quot; in comment 0, so I presume you&apos;re not a fan of that one? I&apos;m not sure what to do here. It would be rather messy to add this flag around all activation behaviours, but I suppose we could do that?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59154</commentid>
    <comment_count>10</comment_count>
    <who name="Olli Pettay">bugs</who>
    <bug_when>2011-10-28 21:48:07 +0000</bug_when>
    <thetext>As I say in comment 2, I changed my mind and prefer what IE does.

But I&apos;d like to know why Opera has implemented the click flag handling
differently.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59237</commentid>
    <comment_count>11</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-10-30 18:17:33 +0000</bug_when>
    <thetext>I don&apos;t understand what IE does, so if you want the spec to say that, please describe it in sufficient detail that I can specify it!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59239</commentid>
    <comment_count>12</comment_count>
    <who name="Olli Pettay">bugs</who>
    <bug_when>2011-10-30 18:34:40 +0000</bug_when>
    <thetext>IE seems to set the flag to event target whenever click is dispatched.
So, not only during click() but also when user clicks some element etc.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59556</commentid>
    <comment_count>13</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-11-03 16:02:17 +0000</bug_when>
    <thetext>That seems reasonable.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59630</commentid>
    <comment_count>14</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-11-04 17:30:05 +0000</bug_when>
    <thetext>EDITOR&apos;S RESPONSE: This is an Editor&apos;s Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Accepted
Change Description: see diff given below
Rationale: Concurred with reporter&apos;s comments.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59631</commentid>
    <comment_count>15</comment_count>
    <who name="">contributor</who>
    <bug_when>2011-11-04 17:31:01 +0000</bug_when>
    <thetext>Checked in as WHATWG revision r6817.
Check-in comment: Change how nested clicks are prevented to also prevent click() inside a regular onclick=&apos;&apos;.
http://html5.org/tools/web-apps-tracker?from=6816&amp;to=6817</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59632</commentid>
    <comment_count>16</comment_count>
    <who name="">contributor</who>
    <bug_when>2011-11-04 17:39:47 +0000</bug_when>
    <thetext>Checked in as WHATWG revision r6818.
Check-in comment: Change how nested clicks are prevented to also prevent click() inside a regular onclick=&apos;&apos;. (part 2)
http://html5.org/tools/web-apps-tracker?from=6817&amp;to=6818</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>