<?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>22974</bug_id>
          
          <creation_ts>2013-08-15 17:53:36 +0000</creation_ts>
          <short_desc>Ancestors of a modal dialog should not originate events</short_desc>
          <delta_ts>2013-09-12 20:52:01 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WHATWG</product>
          <component>HTML</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc>http://jsbin.com/okuqoc/2/edit</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>Unsorted</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Yvonne Yip">ykyyip</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>bugs</cc>
    
    <cc>falken</cc>
    
    <cc>ian</cc>
    
    <cc>mike</cc>
          
          <qa_contact>contributor</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>92101</commentid>
    <comment_count>0</comment_count>
    <who name="Yvonne Yip">ykyyip</who>
    <bug_when>2013-08-15 17:53:36 +0000</bug_when>
    <thetext>Currently a modal dialog makes every node in its document except for the dialog&apos;s ancestors and descendants inert. That means it&apos;s possible for a dialog&apos;s ancestors to originate events.

As a web developer it doesn&apos;t make sense to, for example, be able to click on a modal dialog&apos;s ancestor node. It seems to me that a modal dialog should be defined such that:

* Every node in a modal dialog&apos;s document except for its ancestors and descendants do not participate in events.
* A modal dialog&apos;s ancestors should be able to receive events via event bubbling/capturing, but cannot be an event target.
* A modal dialog&apos;s descendants participate in events as normal.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>92114</commentid>
    <comment_count>1</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-08-15 20:50:45 +0000</bug_when>
    <thetext>Any node, even an inert node, can be an event target. All it does, basically, is prevent clicks and doesn&apos;t let you focus the element. What ancestors are you imagining a &lt;dialog&gt; having where it would be bad if they could be clicked or focused?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>92120</commentid>
    <comment_count>2</comment_count>
    <who name="Yvonne Yip">ykyyip</who>
    <bug_when>2013-08-15 21:28:52 +0000</bug_when>
    <thetext>Can an inert node be an event.target? I thought an inert node behaves as if it&apos;s missing and therefore can&apos;t be an event.target.

I think in all cases it would be bad to be able to click on a modal dialog&apos;s ancestor. For example, below it doesn&apos;t make sense if you can click on #div1 when the modal dialog is open.

&lt;body&gt;
  &lt;div id=&quot;div1&quot; style=&quot;position:absolute;top:0;left:0;width:100px;height:100px;&quot;&gt;
    &lt;dialog&gt;&lt;/dialog&gt;
  &lt;/div&gt;
&lt;/body&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>92123</commentid>
    <comment_count>3</comment_count>
    <who name="Yvonne Yip">ykyyip</who>
    <bug_when>2013-08-15 22:40:01 +0000</bug_when>
    <thetext>Example where you can select text behind a modal dialog: http://jsbin.com/evafib/1/edit

Example where you can toggle a modal dialog by clicking on the parent: http://jsbin.com/eqidoc/1/edit</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>92135</commentid>
    <comment_count>4</comment_count>
    <who name="Matt Falkenhagen">falken</who>
    <bug_when>2013-08-16 04:23:42 +0000</bug_when>
    <thetext>I&apos;m still undecided about the ideal behavior, but want to point out two use cases for clicking outside the dialog:

1. Clicking outside to dismiss the dialog. For example, go to https://twitter.com/WHATWG while not logged in and try to Retweet something. Clicking outside the resulting dialog dismisses it.

2. Clicking outside shakes the dialog. For example, in Chrome, go to chrome://settings/fonts and click outside the dialog.

It&apos;s possible ::backdrop meets these use cases (see bug 22569).

(In reply to comment #3)
&gt; Example where you can select text behind a modal dialog:
&gt; http://jsbin.com/evafib/1/edit

This is an implementation bug: http://crbug.com/252071
Although the spec just says the user agent may prevent the user from selecting text.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>92202</commentid>
    <comment_count>5</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-08-16 21:04:58 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt; Example where you can select text behind a modal dialog:
&gt; http://jsbin.com/evafib/1/edit

The Text nodes here are inert, so you shouldn&apos;t be able to select them. It&apos;s onl the &lt;body&gt; that&apos;s not inert.


&gt; Example where you can toggle a modal dialog by clicking on the parent:
&gt; http://jsbin.com/eqidoc/1/edit

Use a &lt;button&gt; for a button, not a &lt;div&gt;.


(In reply to comment #2)
&gt; Can an inert node be an event.target?

Yes. What did you read that made you think otherwise?


The problem with making the ancestors inert is that &quot;inert&quot; is defined to operate on entire subtrees, so if the ancestor was inert, the &lt;dialog&gt; would be too.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>