Is there any compelling reason why we shouldn't use custom tag names for tabular data?

37 views
Skip to first unread message

Chris Gallo

unread,
Feb 20, 2015, 12:32:34 PM2/20/15
to polym...@googlegroups.com
Because of browser inconsistency with table related elements, I'd like to use non-table tags for displaying tabular data.
I also hate div soup. My solution is just to use my own tags for the various table elements (table-header, table-body, row, cell) 
and give them the appropriate display property. 
This seems to work just fine across browsers, are there any pitfalls to this approach that anyone can think of?

Rob Dodson

unread,
Feb 20, 2015, 4:54:43 PM2/20/15
to Chris Gallo, polymer-dev
I immediately think of accessibility. Depending on what you're building, you could type extend the native elements (ex: <table is="foo-table"> , <tr is="foo-tr">, etc) and still benefit from built in accessiblity

Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups "Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to polymer-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/287580db-744d-48a1-9096-1753687d832c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Chris Gallo

unread,
Feb 20, 2015, 7:06:51 PM2/20/15
to polym...@googlegroups.com, gall...@gmail.com
You could use Aria roles for accesibility. So your markup could look like:
<data-table role="grid">
    <row role="row">
        <cell role="columnheader">...</cell>
        ....
    </row>
    <row role="row">
        <cell role="gridcell">...</cell>
        ...
    </row>
</data-table>

This page has an example with spans: 

But my argument is, if we're just using div's and span's, why not use custom tags that are more descriptive? 

Rob Dodson

unread,
Feb 20, 2015, 8:45:13 PM2/20/15
to Chris Gallo, polymer-dev
Yeah you can totally go that route (using ARIA roles). I was just pointing that out as a potential pitfall. Otherwise, I see no other reason. Table is a notoriously non-responsive element, so having a nicer alternative is something I'm all for :)

Steve Faulkner

unread,
Feb 21, 2015, 4:51:13 AM2/21/15
to Chris Gallo, polymer-dev
Note that ARIA grid/gridcell roles do not map directly to table/cell
see
Notes on fixing incorrect table structure using ARIA
http://www.paciellogroup.com/blog/2014/10/notes-on-fixing-incorrect-table-structure-using-aria/

--

Regards

SteveF
HTML 5.1

Reply all
Reply to author
Forward
0 new messages