Item14353: a td in a thead is not translated into a table header

pencil
Priority: Normal
Current State: No Action Required
Released In: n/a
Target Release: n/a
Applies To: Extension
Component: WysiwygPlugin
Branches:
Reported By: MichaelDaum
Waiting For:
Last Change By: CrawfordCurrie
The new tinymce produces

<table>
   <thead>
      <tr>
         <td>...</td>
         <td>...</td>
         <td>...</td>
      </tr>
   </thead>
   <tbody>
      ...
   </tbody>
</table>

Alas thead > tr > td is not translated into a TML table header.

-- MichaelDaum - 24 Mar 2017

I cannot recreate this. On a fresh master checkout, I created a table:
| *h1* | *h2* | *h3* |
| data1 | data2 | data3 |
b When I enter wysiwyg, the generated HTML is:
<tbody>
<tr>
<th>h1</th>
<th>h2</th>
<th>h3</th>
</tr>
<tr>
<td>data1</td>
<td>data2</td>
<td>data3</td>
</tr>
</tbody>
</table>

How are you creating the errors? ... Ahh. I think that this is working as designed.

The important piece are the "cell attributes" and not the "row attributes". If you highlight the row, and then Rightclick -> Cell Attributes and set them to Header cells, then you get proper TML behavior. If you right-click, and set the row to a "header row", Then the cells remain as data cells, and not header cells.

-- GeorgeClark - 24 Mar 2017

(17:37:31) gac410: I don't think Item14353 is a bug.   It's working as designed. :P
(17:37:32) FoswikiBot: https://foswiki.org/Tasks/Item14353 [ Item14353: a td in a thead is not translated into a table header ]
(17:38:15) gac410: If you highlight a row, right-click,  edit cell properties,  and make them header cells,  it works fine.
(17:38:50) gac410: if you highlight a row, and make the row a "header row" but leave all the cells as data cells,  you don't get header cells.
(17:39:38) gac410: I guess it could be argued that if you make a row a header row, then all the cells within ought to be header cells,  but I'm not convinced :D
(17:39:46) cdot: It's a point though. What is a "header"? Is it a row inside a THEAD, or is it a TH? HTML is typically vague.
(17:40:27) gac410: y.   TML doesn't really have any way to mark an entire row as a header.   It's purely a cell by cell determination.
(17:42:38) cdot: sure. And THEAD is just a notational convenience https://www.w3.org/TR/html5/tabular-data.html#the-thead-element
(17:43:16) cdot: also there is no "TCOL" concept in HTML (how would that work?) . THEAD really is nasty, and probably should be avoided.
(17:44:52) cdot: in roundtrip terms, if <thead><tr><td>Fred</td></tr></thead> were mapped to | *Fred* | there would be no way to get back to the HTML, as | *Fred* | is <tr><th>Fred</th></tr>

Conclusion: No action necessary

-- Main.CrawfordCurrie - 24 Mar 2017 - 18:49.

This is irritating for me and probably other users as well: I just wanted to make the first row a header. Harder than I thought in TinyMCE... frown, sad smile

From the perspective of TinyMCE and HTML there are two ways:

(1)

  • right-click-on-row
  • select row
  • select row properties
  • choose row type = header

This produces a thead > tr > td. Alas, saving this thing does not produce a tml header row. It simply ignores the thead. the round trip moves this row into the tbody again for obvious reasons.

(2)

  • mark all cells of a row
  • right-click
  • select cell
  • select cell properties
  • choose cell property = header

This produces a tbody > tr > th ... and will be transformed into a proper tml header row. Saving the topic will produce a thead > tr > th in the page. Editing it in TinyMCE treats it as a tbody > tr > th again. This is not in sync.

I don't think that this behaviour is a "No Action Required". It clearly is buggy. I.E. approach (1) seems to be a lot more obvious to make a row a header row by changing the row's properties, not the properties of the cells within. In approach (2) you will have to select all cells of a row and make them header cells ... which in effect converts the row into a header row ... after save.

I don't have an idea what to do here. What I think we can do is to change the transformation in a way that thead > tr > td will result in a header row as well. Both approaches (1) and (2) should be treated the same way by create the same TML.

-- MichaelDaum - 24 Mar 2017

CDot and I have discussed this some. The HTML2TML code could possibly auto-bold all cells inside a <thead>. But that would introduce a separate issue where it's not possible to have a non-header cell in a header row. Since TML has no row-level concepts, we think that this really should be a documented restriction.

Another way to look at it, CDot suggested, and it's correct: Setting a row to a "header row" gives you nothing to see. There is no WY"See" in there. So when you save, you get a plain old row. Set the cells to header cells, they become bold, and you get what you see.

-- GeorgeClark - 24 Mar 2017

The latter is merely a css issue, isn't it.

-- MichaelDaum - 24 Mar 2017

No, it's a behavioural issue. I agree that the correct behaviour for the relevant control in TinyMCE should be to covert the selected row to a header row; not to simply place the cells in a THEAD. But that's an issue with TinyMCE, not with WysiwygPlugin (or even with TinyMCEPlugin, though that may be the route by which it gets "fixed".

I really don't think WysiwygPlugin should be doing what you suggest. It runs counter to the definition of HTML and TML.

-- Main.CrawfordCurrie - 28 Mar 2017 - 12:51

 

ItemTemplate edit

Summary a td in a thead is not translated into a table header
ReportedBy MichaelDaum
Codebase trunk
SVN Range
AppliesTo Extension
Component WysiwygPlugin
Priority Normal
CurrentState No Action Required
WaitingFor
Checkins
TargetRelease n/a
ReleasedIn n/a
CheckinsOnBranches
trunkCheckins
masterCheckins
ItemBranchCheckins
Release02x01Checkins
Release02x00Checkins
Release01x01Checkins
Topic revision: r7 - 28 Mar 2017, CrawfordCurrie
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy