Page MenuHomePhabricator

Table summary should render HTML5
Open, LowPublic

Description

Current table syntax allows the generation of a summary:

{| summary="This is a summary"

Which renders:

<table summary="This is a summary">

This is no longer valid in HTML5.

Propose that this should render within the caption using HTML5 tags:

<caption>
 <details>
  <summary>This is a summary</summary>
 </details>
</caption>

Details

Reference
bz41917

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 12:51 AM
bzimport set Reference to bz41917.
bzimport added a subscriber: Unknown Object (MLST).

Given that $wgCleanupPresentationalAttributes was removed from MW (bug 40632), do we still want this kind of transformation being made by its parser?

This isn't like <tt>, which is whitelisted HTML markup but obsolete. This is wikimarkup which is now rendering obsolete HTML. The current code just needs to be updated.

This isn't like <tt>, which is whitelisted HTML markup but obsolete. This is wikimarkup which is now rendering obsolete HTML. The current code just needs to be updated.

If I see <tt> in content, I can easily fix it. There is no way an editor can fit table summary.

Wikitext tables support captions.

{|

Caption

! Heading A
! Heading B

-
}

(In reply to comment #4)

Wikitext tables support captions.

{|

Caption

! Heading A
! Heading B

-
}

Yes, they do. But this relates to the table summary, not the caption. HTML5 uses different markup for summary.

And yes, summary is used on the English Wikipedia.

This comment was removed by Gadget850.

The <summary>..</summary> element, which was part of the proposed HTML5 W3C Candidate Recommendation as recently as 4 February 2014, is not part of the W3C Recommendation that was issued on 28 October 2014. The summary= attribute of the <table> tag is in the latter specification, but marked obsolete.

I faced some resistance when I advocated removing this wikitext at WT:WP Accessibility/Archive 6#Status of table summaries.

I think my points are salient, but that's just me (you should either make the table a simple [data] table or make the table explanation visible to everyone rather than just in the attribute).

Izno updated the task description. (Show Details)

I want to work on this, could you please assign this to me and provide its source code I'm new here so I am facing some difficulty with the same.

Thank you for tagging this task with good first task for Wikimedia newcomers!

Newcomers often may not be aware of things that may seem obvious to seasoned contributors, so please take a moment to reflect on how this task might look to somebody who has never contributed to Wikimedia projects.

A good first task is a self-contained, non-controversial task with a clear approach. It should be well-described with pointers to help a completely new contributor, for example it should clearly pointed to the codebase URL and provide clear steps to help a contributor get setup for success. We've included some guidelines at https://phabricator.wikimedia.org/tag/good_first_task/ !

Thank you for helping us drive new contributions to our projects <3

Not a good first task. It is not agreed much less known what the intended end state is.

Sorry Izno, I missed your comment which advocated a different end result. As the summary element is also visible to sighted readers, I support the approach in the task description.

I think that would create an impedance mismatch when someone needs to dip into the different register of speaking about wikitext tables as direct parallels of HTML tables. This is common both in learning wikitext tables, but also when a user needs to transition to using HTML tables (because of their use in modules, or in Javascript, or whatever).

The attribute should be simply treated as deprecated and moved or removed in their entirety in the source wikitext. See also T173944: Linter should lint for obsolete HTML attributes.

Are Wikitext tables not supposed to be analogous to HTML tables? It looks like the parser renders them into an HTML table.

Are Wikitext tables not supposed to be analogous to HTML tables? It looks like the parser renders them into an HTML table.

They are. That's the point I'm making. The summary attribute was an attribute on HTML tables, now it's not, and the task's original proposal is to change the wikitext transform to be a mess of HTML that isn't the straightforward translation of wikitext table to HTML table.

Hmm, I get what you're saying now. However, while it's certainly not straightforward from the Wikitext to the HTML, I think it's fairly straightforward the other way around.
Timeshifter also suggested an approach used as an example by https://www.w3.org/WAI/tutorials/tables/caption-summary/: put the summary in a span that's linebreak below the table caption and within the table caption element. (I'm not saying we should use the <br> element used in the example for this; I'm sure CSS may accomplish the same effect.)