<?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>13841</bug_id>
          
          <creation_ts>2011-08-19 19:30:43 +0000</creation_ts>
          <short_desc>Investigate what should happen when hitting Enter inside nested single-line containers</short_desc>
          <delta_ts>2011-10-26 20:21:41 +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 - HTML Editing APIs</component>
          <version>unspecified</version>
          <rep_platform>All</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>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Aryeh Gregor">ayg</reporter>
          <assigned_to name="Aryeh Gregor">ayg</assigned_to>
          <cc>ehsan</cc>
    
    <cc>eoconnor</cc>
    
    <cc>ian</cc>
    
    <cc>jackalmage</cc>
    
    <cc>mike</cc>
    
    <cc>public-webapps</cc>
          
          <qa_contact name="HTML Editing APIs spec bugbot">sideshowbarker+html-editing-api</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>55498</commentid>
    <comment_count>0</comment_count>
    <who name="Aryeh Gregor">ayg</who>
    <bug_when>2011-08-19 19:30:43 +0000</bug_when>
    <thetext>WebKit bug: https://bugs.webkit.org/show_bug.cgi?id=23507

Example: &lt;ol&gt;&lt;li&gt;&lt;p&gt;foo[]bar&lt;/ol&gt;.  Does hitting Enter create

  &lt;ol&gt;&lt;li&gt;&lt;p&gt;foo&lt;p&gt;[]bar&lt;/ol&gt;

or

  &lt;ol&gt;&lt;li&gt;&lt;p&gt;foo&lt;li&gt;&lt;p&gt;[]bar&lt;/ol&gt;

?  The latter makes much more sense in this case, IMO, because visually the &lt;p&gt; is invisible.  Probably if a &lt;p&gt; or &lt;div&gt; is nested inside a single-line container at any depth, we should make the outer container the one we split, if we&apos;d normally split it at all.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>55500</commentid>
    <comment_count>1</comment_count>
    <who name="Tab Atkins Jr.">jackalmage</who>
    <bug_when>2011-08-19 19:39:20 +0000</bug_when>
    <thetext>I want both behaviors at different times, unfortunately.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>55505</commentid>
    <comment_count>2</comment_count>
    <who name="Aryeh Gregor">ayg</who>
    <bug_when>2011-08-19 19:56:10 +0000</bug_when>
    <thetext>When would you want to not create a new list item here?  Keep in mind that you can always hit Shift-Enter or Ctrl-Enter or whatever to insert a &lt;br&gt; instead of splitting the current block, regardless of whether there&apos;s a &lt;p&gt; inside the &lt;li&gt;.

Also note that generally, the editing spec will not nest &lt;p&gt; or &lt;div&gt; inside &lt;li&gt; or similar.  E.g., if you run insertorderedlist on a &lt;p&gt; or &lt;div&gt;, it will be transformed into an &lt;li&gt;; and if you then run outdent, it will become a &lt;p&gt; again.  So this situation shouldn&apos;t normally come up in contenteditable-created content anyway, once everyone follows the spec.

But if you have use-cases or more explanation to offer, I&apos;d love to hear them!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>55506</commentid>
    <comment_count>3</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-08-19 19:59:27 +0000</bug_when>
    <thetext>I write pages with multiple paragraphs in a list item all the time, but I agree that an editor should start a new list item when you try to break a paragraph in one. That&apos;s what editors do.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>55508</commentid>
    <comment_count>4</comment_count>
    <who name="Tab Atkins Jr.">jackalmage</who>
    <bug_when>2011-08-19 20:01:05 +0000</bug_when>
    <thetext>Ah, if you can reliably insert a &lt;br&gt; with a chord, then the behavior of just hitting Enter should indeed be to start a new list item.

(Sorry for the noise - I&apos;m not totally familiar with the assumptions of the editting spec.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>55559</commentid>
    <comment_count>5</comment_count>
    <who name="Ehsan Akhgari [:ehsan]">ehsan</who>
    <bug_when>2011-08-22 03:28:01 +0000</bug_when>
    <thetext>What do you mean by single-line containers?  You mean containers which appear on a single line on the screen?  If yes, I don&apos;t think we should differentiate based on whether the container gets any line breaks or not.  If, however, you&apos;re talking about block elements, then the second behavior in comment 0 would make sense to me.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>55588</commentid>
    <comment_count>6</comment_count>
    <who name="Aryeh Gregor">ayg</who>
    <bug_when>2011-08-22 19:15:31 +0000</bug_when>
    <thetext>&quot;Single-line container&quot; is a term I made up:

http://aryeh.name/spec/editing/editing.html#single-line-container

The current list is: address, div, h1, h2, h3, h4, h5, h6, listing, p, pre, xmp, li, dt, dd.  They&apos;re basically used for formatBlock and inserting line breaks, with some of the salient points being

* formatBlock converts all selected single-line containers to the given type.  If something isn&apos;t nested in one, it adds one around it.
* Hitting Enter (= insertParagraph) usually finds the nearest ancestor single-line container, clones it, sticks the clone after the original, and moves the cursor and anything after it to the new container.  There are a bunch of exceptions to this, though.

The idea is to adjust the second point in the event single-line containers are nested.  The spec algorithms avoid nesting single-line containers, but we still have to deal sensibly with cases where they came pre-nested.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>55604</commentid>
    <comment_count>7</comment_count>
    <who name="Ehsan Akhgari [:ehsan]">ehsan</who>
    <bug_when>2011-08-22 20:23:09 +0000</bug_when>
    <thetext>(In reply to comment #6)
&gt; &quot;Single-line container&quot; is a term I made up:
&gt; 
&gt; http://aryeh.name/spec/editing/editing.html#single-line-container

Ah yes, sorry I missed that.  I have a note written somewhere that I think we need another name for this concept, and this is an example why!  :-)

Given that, I think your second proposal makes sense to me.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59002</commentid>
    <comment_count>8</comment_count>
    <who name="Aryeh Gregor">ayg</who>
    <bug_when>2011-10-26 20:21:41 +0000</bug_when>
    <thetext>http://dvcs.w3.org/hg/editing/rev/8578618a74e6</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>