[Bug 15100] Right-aligning a numeric table column is much more work than it should be

https://www.w3.org/Bugs/Public/show_bug.cgi?id=15100

Brian Lalonde <brian@webcoder.info> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WONTFIX                     |

--- Comment #16 from Brian Lalonde <brian@webcoder.info> 2012-01-28 23:28:48 UTC ---
(In reply to comment #15)

Reopening because I believe there was some misunderstanding. I'll try to
clarify.

I see that your CSS does work for the example, but it would be particularly
fragile. Adding a column between or after those two, with any differing
alignment needs, would break it.

:nth-col() would be more durable in the face of rowspans, but still requires
keeping the CSS in perfect sync with the markup. The '//' combinator allows
some decoupling of presentation from position, but requires CSS support, and
provides no numeric semantics, by which I mean potential support for localized
presentation (commas & decimals), numeric sorting, database import, advanced
indexing & querying, &c.

> In such a context [user-generated content]
> you can just define a class value for the styles you want and
> let users use that. This is the same as how HTML doesn't offer a way to change
> the colour of text, even though sometimes the preferred way to indicate a
> particular semantic is colour.

I was speaking as a user, not as the sysadmin. All of these solutions require
nontrivial CSS control.

User-authors of forum posts, wikis, other user-contributed content, and even
emails, rarely have access to directly manage the CSS.

> > Since we are already decorating each cell, why not provide a semantic element
> > that at least provides a hint to the renderer as to the fundamental type of the
> > data. A semantic element would be far more concise (<tn> rather than <td
> > class=n>), and wouldn't require an external style rule to work.
> 
> There's a number of ways of doing this within a site (e.g. class values, data-*
> attributes, the <data> and <time> elements); if this is something that gets a
> lot of adoption, it would make sense to provide a more formal solution. 

Decorating each cell is exactly the "work" I'm referring to:

    <td align=right> - The only one that works in user-contrib contexts,
WYSIWYG editors, and most emails. Presentational markup. No built-in numeric
semantics.
    <td class=n> - The current solution for site admin contexts. Verbose, and
no built-in semantics. Requires add'l CSS support.
    <td data-type=n> - No built-in semantics. Requires add'l CSS support.
    <td><data value=999.99>999.99 - Still no semantics, and redundant.

vs.

    <tn> - Built-in numeric semantics AND formatting. Efficiently terse.

Would the benefits of a more formal solution (supporting highly granular
datatypes such as various date and time levels, booleans, durations, &c.) to
support localized presentation and sorting be worthwhile? I'm not sure the
expectations for those types are as consistent.

> But in practice I haven't seen this kind of thing much. More objective research would
> be useful.

I'm a bit incredulous that you haven't seen much use of numeric data in tables
that the author (who may not control the CSS for the site) wishes to be
right-aligned (is this culture-dependant?), with the hope that the browser will
be just aware enough of the broad datatype to better display it (and maybe
more). It's possible I've misunderstood your statement.

More objective research would certainly be useful, especially if it presents
any statistical findings as tabular data with numeric columns! ;)

As always, thanks for your time!

-- 
Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Saturday, 28 January 2012 23:29:01 UTC