News for hackers. Stuff that matters.
Re:CSS Absolute Centering by ricardobeat on Saturday August 10, 2013 @03:12PM (#6192273)
Being "semantic" (your quotes) is not an abstract concept or dogma. This discussion has been exhausted as far back as 2005. A more practical explanation:

HTML is meant to be parsed and interpreted by machines too, with no visual representation. Tags are meta-data about their content. A 'table' element says "I contain tabular data", and user agents will make lots of assumptions based on that. One of the consequences of this is you'll be giving bad data to search engine bots, that's why it's bad for SEO.

HTML is also meant to be used by non-visual interpreters, like screen readers. Assistive technology is not only for the legally blind; visual impairment affects 20-30% of the world's population. We don't see high user %s because they just most won't bother, it's too hard, sites' HTML is broken, it is easier to have somebody look it up for you.

Going on a little more over semantics, there are rules for what elements can contain each other, so that a structure can be inferred based on headings and hierarchy. By not following the rules you are wreaking havoc on this, and preventing aforementioned bots and screen readers from providing meaningful navigation and context for your page.

We were supposed to have a semantic web by now, where every piece of information was annotated with meaningful meta-data, allowing for context-aware applications (add this commenter on facebook; where can I buy this product?; add this event to my calendar). Turns out it's damn hard to get everyone to use markup correctly, or even agree to common formats.

Re:CSS Absolute Centering by andybak on Sunday August 11, 2013 @04:27AM (#6194327)
> Being "semantic" (your quotes) is not an abstract concept or dogma. This discussion has been exhausted as far back as 2005

No it really wasn't. A small group of people managed to make it orthodoxy and in the intervening years very few of the supposed benefits have materialised.

In the meantime the same arguments that it is pie-in-the-sky have persisted and events have supported them.

The argument isn't even internally consistent as in the real world people are debating one kind of tag soup vs another. If the only way to create a particular appearance is either using several wrapper divs or a table then you're splitting hairs.

<div><div><div></div></div></div> vs <table><tr><td></td></tr></table>

Is that a semantic difference worth fighting for?

The real gains in the semantic web have come from small targeted blocks of metadata and natural language processing. Not waiting around for everyone to figure out <section> vs <article> correctly.

<clarification> I'm not arguing against the benefits of semantic markup - just that a lot of the hand-wavey "this is semantic and this isn't" advice that gets thrown around is either nonsense or adds such a microscopic amount of semantic information that it's not actually providing any benefit to anyone. The real test is to list actual benefits for actual user agents.</clarification>

Re:CSS Absolute Centering by ajanuary on Sunday August 11, 2013 @06:19PM (#6196557)
Tables have a well(ish) defined semantics that you're breaking. Those semantics give rise to real practice benefits like navigating via column and row with screen readers or hinting how best to split a table up into multiple pages when printing.

Practically, the way it's ended up, the semantics of a div is "some stuff". It's evolved into the go-to method to hide a multitude of styling sins. I don't think there's anything hugely hypocritical in limiting any ugly semanticless hacks to a single generic container like divs.

Put as much as you can into semantic markup, and then anything else you really can't fit into that, favour using div soup over breaking the semantics of another tag.

Re:CSS Absolute Centering by Daniel_Newby on Sunday August 11, 2013 @11:22PM (#6197486)
What about inline elements inside divs? Even the semantic correctness crusaders freely resort to abuse of <b> and <i>.

HTML lacks extensibility. If you want to move beyond classical typography you have to make heinous compromises, and there is no reason <table> should be specially exempt.

Re:CSS Absolute Centering by ajanuary on Monday August 12, 2013 @02:08AM (#6197900)
I agree we have to make compromises because HTML has huge shortcomings. My point, and the point of a lot of people advocating semantic markup, is that if you have to resort to hacks, prefer lots of uly generic containers like divs and spans to misusing things that have better defined semantics that are actually of use to people, like tables. I can't think of anything you can do with tables that you can't do with an ugly mess of divs and a little compromise in cross-browser consistency.
Re:CSS Absolute Centering by PavlovsCat on Sunday August 11, 2013 @08:31AM (#6194812)
Amen! For example, what is the practical advantage of using <footer>, <aside>, <artice>, <section>, today? I only ever hear "search engines or screen readers can/could do X", that but nothing about what any user agents or bots actually do. No examples, and no way for me to detect any difference it would make anywhere (other than having to include HTML5 shims for IE). That doesn't do a lot to get me interested in paying attention to that stuff, to move beyond "does it look how I want it to". In short, don't tell me what I should do for the robots, tell me what the robots are doing for me (or other people), with that stuff.
Re:CSS Absolute Centering by ricardobeat on Sunday August 11, 2013 @09:48PM (#6197231)
There are plenty of examples, articles, tutorials, videos, presentations on that topic (many linked here in this thread). You won't find what you're not looking for.
Re:CSS Absolute Centering by PavlovsCat on Monday August 12, 2013 @01:29PM (#6200458)
"on that topic", or answering the very specific question I asked?
Re:CSS Absolute Centering by wwweston on Saturday August 10, 2013 @06:47PM (#6192958)
If using tables for layout broke non-screen user agents (like screen readers and Google), then the web must have been more or less unusable by them until at least 2005. We know that's not true for Google, at least, and by 1999, Lynx actually had some capability for dealing with them.

Even if layout tables did present a problem, an easy incremental fix convention (say, `<table class="layout">`) might have been a nice addition to user agents for situations where people either hadn't invested in semantic markup + CSS yet ... or for the layouts beyond CSS capabilities.

That isn't to say that I think everybody should be using tables for layout or CSS completely sucks or we'd all be better off if we were doing layout like the Java/C#/Flash/Python library of your choice does it.

I'm just not sure the "tables break things" argument is particularly strong.

Re:CSS Absolute Centering by ricardobeat on Saturday August 10, 2013 @07:10PM (#6193016)
Yes, using a screen readers with a table-based website has always been a nightmare. Google invested heavily on research to be able to make sense of tag soup, that's one of the reasons it could provide way better results than anyone else. It's an ugly workaround, like printing a document and scanning it back instead of copying a file. See rest of discussion above.
Re:CSS Absolute Centering by wwweston on Saturday August 10, 2013 @07:32PM (#6193075)
> Yes, using a screen readers with a table-based website has always been a nightmare.

Have you experienced this personally, or do you have this on first-hand account, or are you repeating the common wisdom?

Because like I said, Lynx had a way of doing this circa 1999. It mostly ignored tables except a few that met some criteria for likely semantics. So you generally got a cell-ordered page, which worked surprisingly well for most sites. Heck, if you've got a copy of Lynx at hand, fire it up right now and browse HN (which is layed out via table, ridiculous though it is for a site with such a simple layout).

If Lynx can do it, I have trouble believing that deliberately assistive software wouldn't be able to. This matches most of the (admittedly limited) discussion I've had with people who use/write it (an aside: I've also heard that, believe it or not frames were sometimes a big boost to assisted usability).

If you've got personal experience or first-hand accounts, though, I'm interested to hear it.

Re:CSS Absolute Centering by ricardobeat on Saturday August 10, 2013 @08:23PM (#6193199)
I used to work at a company specialized in front-end development, where we used NVDA, Voiceover, Window-Eyes and Jaws extensively while building and testing websites, sometimes for legal compliance.

Lynx is a text-mode browser, not a screen reader; it's still visual. Assistive tech has a whole lot more going on. They have a slew of navigation modes and need cues from content to prevent the user from getting lost, you can't just scroll or look back up to where you where. I recommend looking at the resources below, and trying to use an iPhone or mac with voiceover and screen curtain enabled to really experience what it is like.

http://alistairduggin.co.uk/blog/screenreader-resources/ (collection of videos & articles)

http://www.youtube.com/watch?v=izrC4R7SsH4

http://www.youtube.com/watch?v=S4QBqpU1jj8

http://www.youtube.com/watch?v=AmUPhEVWu_E

http://www.youtube.com/watch?v=vK1tlLOavvM (linked by PavlovsCat below)

Re:CSS Absolute Centering by wwweston on Sunday August 11, 2013 @12:29AM (#6193835)
> Lynx is a text-mode browser, not a screen reader; it's still visual.

Sure. The point isn't that Lynx is an assistive UA, the point is that it's at least one UA that figured out how to throw away layout-purposed table markup (which, like some assistive UAs, doesn't make any sense in its rendering context) and still render (some) markup that represented tabular data.

Is it really the only one?

> Assistive tech has a whole lot more going on. They have a slew of navigation modes and need cues from content to prevent the user from getting lost, you can't just scroll or look back up to where you where

Right, but is that really tied up with non-semantic table use? I'd think it's the presence or absence of things like access keys, title/alt text, and I guess at this point aria attributes that makes the difference, not table markup.

Re:CSS Absolute Centering by ricardobeat on Sunday August 11, 2013 @10:33PM (#6197360)
Exactly, Lynx is not an assistive UA. Keyword there is `render`. It makes very little use of tags' semantic meaning compared to a screen reader. Alt/title attributes are just a small part of the picture.

You are underestimating the damage bad markup does, and how deeply assistive software relies on semantics/metadata/structure. As I said, just fire up voiceover and try to browser HN. Actually, I'll quickly do that for you:

http://cl.ly/3l3E2C000419

I'm comparing table-based HN to one of it's alternative interfaces, not ideal but much better. It's a very shallow example, and I'm using only basic navigation commands - experienced users can use more complicated navigation schemes to discover content, out of necessity - but you get the idea. Lots of noise (row x of x, column xxx..), blank cells are "read", etc. Remember HN is a very simple and spartan website, now imagine what a slightly more complex nested table layout looks like.

Also, see WebAIM surveys for actual assistive tech usage data: http://webaim.org/projects/

Re:CSS Absolute Centering by wwweston on Monday August 12, 2013 @03:01AM (#6198021)
> Lynx is not an assistive UA. Keyword there is `render`. It makes very little use of tags' semantic meaning compared to a screen reader.

It is, however, apparently smarter about the use-semantics of table markup than most screen readers, if I'm to take your example as the norm.

> imagine what a slightly more complex nested table layout looks like.

Having spent more time than I care to remember inside the code of complex nested table layouts, I unfortunately don't really have to work too hard to imagine. :/

> You are underestimating the damage bad markup does, and how deeply assistive software relies on semantics/metadata/structure.

I can see/hear from your example that the table markup is a challenge for voiceover.

I'm not sure I was underestimating the damage repurposed markup does more than I was overestimating the ambitions of assistive UI devs. I'm just astounded that voiceover wouldn't haven't implemented at least a mode for making likely distinctions between table markup that's being used for tabular data and table markup that's being used for layout, when making such a distinction is not only clearly possible but has been done.

Then again, I'm astounded that it's 2013 and Adobe still can't install onto case-sensitive volumes, so there's that.

Re:CSS Absolute Centering by bandushrew on Saturday August 10, 2013 @11:49PM (#6193763)
ARIA provides a solution for the problems caused by <table>.
Re:CSS Absolute Centering by DougBTX on Saturday August 10, 2013 @06:52PM (#6192975)
If I remember correctly, the summary="", was suggested for layout tables. I never looked into screen reader support for that though.
Re:CSS Absolute Centering by wwweston on Saturday August 10, 2013 @07:11PM (#6193017)
That's smart. A present but blank summary attribute would've been a great indicator.

I also think that it could've been done pretty reliably by heuristics. A table that mostly has data cells that contain lots of images or block-level markup as descendants is quite likely a markup table. A table that has mostly text or inline-marked cells and has a full summary attribute or <caption> is all but certainly semantic.

I guess with IE 6&7 all but dead, though, it's sortof irrelevant now -- you can mostly count on `display: table-cell` to help you out of a jam.

Re:CSS Absolute Centering by steveax on Sunday August 11, 2013 @12:06AM (#6193792)
What you want to make (modern) screen readers not try and parse the table semantics is to set the role to presentation:

<table role="presentation">

Re:CSS Absolute Centering by yetanotherjosh on Saturday August 10, 2013 @07:31PM (#6193070)
"Turns out it's damn hard to get everyone to use markup correctly, or even agree to common formats" - perhaps because it's damn hard (read: often impossible) to get the intended visual presentation for the majority audience of sighted users to look right without resorting to non-semantic markup.
Re:CSS Absolute Centering by dredmorbius on Saturday August 10, 2013 @10:57PM (#6193644)
I've pretty much abandoned many sites' designated markup for either 1) Readability's version or 2) my own CSS using Stylebot. It's relatively easy to make significant corrections quickly, and for sites I spend significant time on (say, G+, HN) it's downright useful.

Some examples from an earlier post:

Hacker News itself: http://stylebot.me/styles/2945 Buzzfeed was particularly fun: https://plus.google.com/104092656004159577193/posts/G6pzJBLK.... NY Times and Edge Perspectives: https://plus.google.com/104092656004159577193/posts/NUMQuQUh.... Basically: if it moves, is fixed, is an interstitial, or is just plain annoying, I kill the hell out of it. And with Stylebot, the easy stuff is just point, click, and "Hide". Then it's gone. Bring it on.

Re:CSS Absolute Centering by icantthinkofone on Sunday August 11, 2013 @08:11AM (#6194788)
The guy who first thought of using tables for layout lamented this back in 1997 in "The Web is Ruined and I Ruined It": http://www.xml.com/pub/a/w3j/s1.people.html