<?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>24372</bug_id>
          
          <creation_ts>2014-01-23 14:18:23 +0000</creation_ts>
          <short_desc>Why does the summary element only allow Phrasing content? I ran into a scenario where I needed Heading content in the summary to maintain a proper document outline. Without this, I was left to choose  [...]</short_desc>
          <delta_ts>2014-01-27 20:01:57 +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>Other</rep_platform>
          <op_sys>other</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc>http://www.whatwg.org/specs/web-apps/current-work/#the-summary-element</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>Unsorted</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>contributor</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>ian</cc>
    
    <cc>me</cc>
    
    <cc>mike</cc>
    
    <cc>zcorpan</cc>
          
          <qa_contact>contributor</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>98942</commentid>
    <comment_count>0</comment_count>
    <who name="">contributor</who>
    <bug_when>2014-01-23 14:18:23 +0000</bug_when>
    <thetext>Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/interactive-elements.html
Multipage: http://www.whatwg.org/C#the-summary-element
Complete: http://www.whatwg.org/c#the-summary-element
Referrer: http://www.whatwg.org/specs/web-apps/current-work/multipage/

Comment:
Why does the summary element only allow Phrasing content? I ran into a
scenario where I needed Heading content in the summary to maintain a proper
document outline. Without this, I was left to choose between invalid markup,
an invalid document outline, or a JS solution.

Posted from: 108.17.8.225
User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.77 Safari/537.36</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99002</commentid>
    <comment_count>1</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2014-01-24 12:24:27 +0000</bug_when>
    <thetext>I don&apos;t see how JS would help you here.

Can you elaborate on your scenario?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99042</commentid>
    <comment_count>2</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-01-24 23:28:13 +0000</bug_when>
    <thetext>A concrete example to look at here would be very helpful. I&apos;m not sure I understand how a heading would work in a &lt;details&gt; element (even in the contents, really, unless you have sectioning content in there).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99084</commentid>
    <comment_count>3</comment_count>
    <who name="Shannon Moeller">me</who>
    <bug_when>2014-01-25 19:17:52 +0000</bug_when>
    <thetext>Here is a simple example of the issue.

    &lt;section&gt;
        &lt;h1&gt;Setion 1&lt;/h1&gt;
        &lt;p&gt;Lorem ipsum...&lt;/p&gt;
        &lt;p&gt;Lorem ipsum...&lt;/p&gt;
    &lt;/section&gt;
    &lt;section&gt;
        &lt;h1&gt;Section 2&lt;/h1&gt;
        &lt;p&gt;Lorem ipsum...&lt;/p&gt;
        &lt;p&gt;Lorem ipsum...&lt;/p&gt;
    &lt;/section&gt;
    &lt;details&gt;
        &lt;summary&gt;
            &lt;h1&gt;Section 3&lt;/h1&gt;
        &lt;/summary&gt;
        &lt;p&gt;Lorem ipsum...&lt;/p&gt;
        &lt;p&gt;Lorem ipsum...&lt;/p&gt;
    &lt;/details&gt;

Because details is a sectioning root, I would expect to be able to define a heading as the expand/collapse target. I would also expect the document outline for this content to be:

- Section 1
- Section 2
- Section 3

Each workaround I&apos;ve been able to come up with requires what I consider to be unacceptable compromises.


1) Duplicate content

    &lt;details&gt;
        &lt;summary&gt;Section 3&lt;/summary&gt;
        &lt;h1&gt;Section 3&lt;/h1&gt;
        &lt;p&gt;Lorem ipsum...&lt;/p&gt;
        &lt;p&gt;Lorem ipsum...&lt;/p&gt;
    &lt;/details&gt;

This is valid markup and produces the expected outline. But, it is potentially confusing for screen readers and would require some heavy-handed CSS to make it look as though there was not duplicate content.


2) Invalid document outline

    &lt;details&gt;
        &lt;summary&gt;Section 3&lt;/summary&gt;
        &lt;p&gt;Lorem ipsum...&lt;/p&gt;
        &lt;p&gt;Lorem ipsum...&lt;/p&gt;
    &lt;/details&gt;

Easier to make &quot;look&quot; right, but doesn&apos;t produce a proper outline.


3) Invalid markup

The original example.


4) JavaScript

    &lt;section class=&quot;details&quot;&gt;
        &lt;h1 class=&quot;summary&quot;&gt;Section 2&lt;/h1&gt;
        &lt;p&gt;Lorem ipsum...&lt;/p&gt;
        &lt;p&gt;Lorem ipsum...&lt;/p&gt;
    &lt;/section&gt;

This ignores that details and summary are even a thing. Valid markup, valid outline, JS dependent expand/collapse functionality. This gets even more complex when trying to have a collapsable fieldset in a form.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99185</commentid>
    <comment_count>4</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-01-27 20:01:51 +0000</bug_when>
    <thetext>Oh, right, I forgot that &lt;details&gt; was a sectioning root.

Yeah, those examples make a lot of sense. I&apos;ve updated the spec to allow this.

Note that the outline still won&apos;t be quite what you expect, because the &lt;details&gt; element&apos;s contents aren&apos;t considered part of the document&apos;s outline, in the same way that (say) a heading in a table or block quote doesn&apos;t actually get listed in the document outline. It&apos;s like a subdocument. (It is, after all, basically a form control, not a part of a document.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99186</commentid>
    <comment_count>5</comment_count>
    <who name="">contributor</who>
    <bug_when>2014-01-27 20:01:57 +0000</bug_when>
    <thetext>Checked in as WHATWG revision r8423.
Check-in comment: Allow &lt;h1&gt; (and company) inside &lt;summary&gt;, so that you can give a &lt;details&gt; element a heading.
http://html5.org/tools/web-apps-tracker?from=8422&amp;to=8423</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>