ElkArte Community

Project Support => General ElkArte discussions => Topic started by: Antechinus on June 23, 2013, 06:17:25 pm

Title: Semantics, HTML5, and other gruesomeness.
Post by: Antechinus on June 23, 2013, 06:17:25 pm
Quote from: TestMonkey –
(07:41:42 PM) groundup: Instead of <div class="windowbg2"> for posts change that to article. Instead of <a id="msg123"> change that to <article id="123"> add a class="unread" for unread posts
(07:42:00 PM) groundup: Just thought of that because of Aaron's PR
(07:45:41 PM) groundup: Use rel="author" for article authors


Um, hold the bus there. Before you get carried away with "It's a new HTML5 tag so I gotta use it", read the W3C definition of the article tag again.

Yes, they do suggest a forum post as one possible example, but the key point is that the article tag is intended to be used only for content which stands on its own, without being directly tied to other items.

This applies to forum posts sometimes, but it sure doesn't apply all the time. IOW, forum posts are not always (indeed, are frequently not) "articles" as defined by the HTML5 specs. Ergo, "article" is not the right way of marking them up, AFAICT.

I suggest that this be re-thought.

I agree that div is a useless tag in this context, so I had thought that (for the moment at least) it would make sense to go back to an idea that has been discussed before, namely marking up thread pages as an unordered list. After all, a thread page really is a list of posts, so that makes semantic sense to me.





ETA: I've been thinking about markup a lot lately. There are quite a few changes that I think would be beneficial, as well as being easy to implement. My intention is to start working on these too.

1/ .cat_bar, .title_bar - These suck. (http://www.councilofexmuslims.com/Smileys/custom/yes.gif)

The only reason .cat_bar and .title_bar went into 2.0.x markup was to enable supporting roundy bar ends in old versions of IE. Since we don't care about that any more, and since the divs have no semantic value, IMO those classes are superfluous.

They're not being used in the default styling at all now, and having thought about it I cannot see how removing them would restrict custom theming much, if at all. I could even easily do roundy bar ends in IE8 without those classes and without js patches.

2/ .catbg and .titlebg - These aren't much better.

First thing is that .catbg2 and .titlebg2 should defo be killed. They're very rarely used and getting rid of them is easy (have done on local).

As for the others (.catbg and .titlebg) the problem is they are too generic, which just ends up complicating the CSS. You often want different styling for table_grid headers and for other headers, so thumping them with the same classes makes no sense. It's just more stuff try and override.

Also, there's no semantic sense to these classes. At the moment .catbg can be either a category header, or a thread page header or a table column header, or several other things. Ditto for .titlebg. Then there's the whole "bg" thing, which would imply that .catbg provides backgrounds for entire categories, which it doesn't do at all.

I'm thinking these classes should be replaced with something like headerbar_h3, headerbar_h4, header_th, etc. This would make a lot more sense.

3/ Tables - Old classes not making much sense here either.

Leaving the headers aside for the moment, and just talking about the tbody stuff, with the new theme we're going for subtle zebra striping on rows. IMO, this is a well-proven way of making densely formatted tables more readable. For forum stuffz, I think it makes a lot more sense than colouring by column.

So that we have class names that do what they say on the tin, and so that we don't have to use efficiency abominations like tr.windowbg2, I think it would be best to use classes like .tablerow1 and .tablerow2. These should only be applied to the .table_grid class, not to any others. The board index and child boards already have their own styling for all cells, and nobody ever styles them by alternating rows.

4/ Which brings us to .windowbg and .windowbg2 - These are horrible too.

We all know what a window is. It's one of those things you open new stuff in, and can be resized and dragged and closed and whatever. That's what "window" means to most people online. Using .windowbg as a class name for something completely unrelated is semantic stupidity, IMO.

For the board index and child boards tables, there's no need for these classes. These tables already have CSS for every cell, and those cells already have their own individual classes. Imposing extra generic classes on top of those is just bonkers.

For the message index table, the same applies. Every cell already has its own class. The generic ones are just bloat, and just make markup and CSS more complex. They should be dropped.

These generic classes make no sense anywhere else either. For thread pages, if you want alternating classes it would make much more sense to use .postbg and .postbg2. I'm not even sure we need to provide for alternating classes in thread pages though, since frankly they seem to be out of fashion and IMHO are unlikely to return. Still, providing for them is fairly simple, but if we are going to do it it should be done by a sensible class.





Next bit: HTML5 stuffz.

Yes, it's all terribly exciting. However, there's still a lack of consensus in some areas as to how certain tags should be used in certain cases.

IMO, the first point to bear in mind is that, apart from code junkies, the only people who care about markup are blind people. Everyone else only cares about how it looks, not about how it runs. So, I'm mainly concerned about tag additions/changes that will enhance a11y for such people. If a change doesn't do that, I'm not that fussed about it.

My 2c is that we should use HTML5 tags where the use of a certain tag is unambiguous. For example, timestamps should use an HTML5 time tag. No worries.

Where the use of a tag is debatable, my 2c is that to save time and aggravation we should just do it old school (but still semantic). Once everything is more sorted, and once there's established consensus on tag usage, people can always look over the less-finished-than-it-is now product and suggest tag changes.
Title: Re: Semantics, HTML5, and other gruesomeness.
Post by: TE on June 24, 2013, 02:32:15 am
Absolutely agree on .cat_bar, .title_bar, catbg, titlebg and and others.. I've always hated these names, they never made any sense to me..
I'd use a flat and simple strucure, though:

<h3 class="content_header"> for cat_bar, catbg
<h4 class="content_header"> for title_bar, titlebg

<p class="post_content"> for windowbg
<p class="post_content_alternate"> for windowbg2
<p class="post_conent_unapproved"> ...

Re HTML5: I've added some HTML5 additions in earlier PRs, mainly enhancements for the <input> boxes (placeholders, autofocus, email input and some <time> tags.. ) I was thinking about adding <input type="date"> for birthdays,  calendar and other date related fields,  but that's a bit more complex since some of the are splitted <inputs> and allow partial content (the birthday for example has inputs for year, month  and day and you can fill only some of them)

I'd be carefullly with semantics addition. Some of them make sense, but it's important to use them in the right context. Not sure, but the initial post could be declared the topic's <header>, the replies would become a <section>
Title: Re: Semantics, HTML5, and other gruesomeness.
Post by: Antechinus on June 24, 2013, 04:11:13 am
Quote from: TE – Absolutely agree on .cat_bar, .title_bar, catbg, titlebg and and others.. I've always hated these names, they never made any sense to me..
I'd use a flat and simple structure, though:

<h3 class="content_header"> for cat_bar, catbg
<h4 class="content_header"> for title_bar, titlebg
Ehhhhhhhhhhhh.........no. :D Not quite.

First thing is that I want to get rid of the cat_bar and title_bar divs entirely, not rename them. They're just bloat now. We only need the h3 and h4 they contain. Getting rid of the divs is easy, and wont mess up theming. On my local host they aren't being used for anything at all now. I could wipe the lot of them without any problem.

Second thing is that I do not want the h3 and the h4 to have the same class name. I'm trying to avoid calling by tag name, as much as is humanly possible. It's the least efficient way to call things in terms of processing*. It's also more confusing. The class names should clearly distinguish between the two elements.


Quote<p class="post_content"> for windowbg
<p class="post_content_alternate"> for windowbg2
<p class="post_content_unapproved"> ...
Those look ok to me, in general, but I'm not sure on the names. They will contain the .poster areas and sigs, as well as actual post content. Something with "background" sort of seems more appropriate. I'm also not sure we should use p tags for them. My 2c is that li makes more sense.


QuoteI'd be carefullly with semantics addition. Some of them make sense, but it's important to use them in the right context. Not sure, but the initial post could be declared the topic's <header>, the replies would become a <section>.
Not sure. IMO, header seems more suitable for headers, like the current h3 stuffz. I'm not that thrilled about the section tag either. Div is supposed to have no semantic meaning, but it's just short for division. A div is a division of the page. In English, at least, section means much the same thing. I honestly cannot see how the latter is more meaningful than the former. They seem to me to mean the same thing. Hey ho.


*Re selectors and processing stuffz: I would prefer to make as many selectors as possible as efficient as possible, for two reasons. First is that, as in the case of the drop menus, having clearer and more targeted classes and id's is usually less confusing when it comes to reading the code.

Second is that regardless of how efficient our selectors are in theory, in practice about half of them will be about twice as slow as they are meant to be. Why? Because we're using variants. Using variants means that a lot of selectors will have to be processed twice: first in index.css and then in the _variant.css.

This wont happen for every selector, but it will happen for a substantial number of them. It wont kill performance if it's done sensibly, but it's something to bear in mind. In view of that, we should avoid calling by HTML tag name as much as possible, and we should avoid calling by descendants as much as possible.

CSS is the opposite to javascript in one odd way. In both CSS and js, calling by id is the most efficient. They differ when it comes to tag names and class names. CSS is faster calling by class name, and js is faster calling by tag name. Also, if you have to call a class in js it's best to tie it to its tag (like ul.quickbuttons) whereas if you need to call a class in CSS you should totally avoid tying it to its tag (just .quickbuttons is much better).
Title: Re: Semantics, HTML5, and other gruesomeness.
Post by: TE on June 24, 2013, 04:50:50 am
QuoteFirst thing is that I want to get rid of the cat_bar and title_bar divs entirely, not rename them. They're just bloat now. We only need the h3 and h4 they contain.
Yep, but that's what I suggested..  I think you misread (or I was unclear, dunno) . Instead of <div class="cat_bar"><h3 class="catbg"> ... use <h3 class="blablabla"> (without that outer div)
Title: Re: Semantics, HTML5, and other gruesomeness.
Post by: Antechinus on June 24, 2013, 04:52:39 am
Oh ok, cool.  :D
Title: Re: Semantics, HTML5, and other gruesomeness.
Post by: Joshua Dickerson on June 24, 2013, 06:57:33 am
They specifically state forum posts. I don't think it gets clearer than that. They didn't say blog posts which have a clear topic and comments. There are even examples of its usage as forum posts around. Every forum post stands alone with clear author, content, header (time at the very least but also the subject).

I didn't want to post because I was just doing it on another thing I am doing and was on #elkarte anyway. It's not a what's new today thing, it is clear and simple and allows for better CSS targeting at least. Also, there are no downsides afaict.
Title: Re: Semantics, HTML5, and other gruesomeness.
Post by: Antechinus on June 24, 2013, 09:26:29 am
No, it doesn't allow for better CSS targeting, because we shouldn't be calling by tag name anyway. We particularly shouldn't be calling by tag name in combination with class name. The tag names shouldn't appear in the CSS at all, except in very rare instances where they can't be avoided. So, whatever tag we choose is effectively neutral for CSS targeting.

The problem with the W3C spec is that it's contradictory (which wouldn't be the first time). Take the post you just made. It doesn't stand alone, because it's a direct reply to one of my posts. If taken out of that context, your posts doesn't make sense. This is common with forum posts.

Quote from: W3CThe article element represents a complete, or self-contained, composition in a document, page, application, or site and that is, in principle, independently distributable or reusable...

Also:
Quote from: HTML5 DoctorThe tricky part is, what exactly is an independent item of content?

The smell test for going independent
An independent piece of content, one suitable for putting in an <article> element, is content that makes sense on its own. This yardstick is up to your interpretation, but an easy smell test is would this make sense in an RSS feed? Of course weblog articles and static pages would make sense in a feed reader, and some sites have weblog comment feeds. On the other hand, a feed with each paragraph of this article as a separate post wouldn’t be very useful. The key point here is that the content has to make sense independent of its context, i.e. when all the surrounding content is stripped away.
This is the problem, IMO. Forum posts often do not make sense when the surrounding content is stripped away. I'm sure you can think of plenty of examples of that. So, if that's one of the main criteria for the use of an article tag, then it woud seem as if an article tag is not appropriate.

Bear in mind that the current W3C spec is a nightly draft, not a final standard.
Title: Re: Semantics, HTML5, and other gruesomeness.
Post by: IchBin on June 24, 2013, 10:47:59 am
I think that for the most part, the original post in a topic definitely fits that description. It's always the topic that starts the discussion. Much like it is on news sites and even blogs. Article fits nicely IMO.
Title: Re: Semantics, HTML5, and other gruesomeness.
Post by: emanuele on June 24, 2013, 10:50:47 am
Quote from: Antechinus – This is the problem, IMO. Forum posts often do not make sense when the surrounding content is stripped away.
And some don't even make sense with the context surrounding them (like my posts :P).
Title: Re: Semantics, HTML5, and other gruesomeness.
Post by: Bloc on June 24, 2013, 12:08:57 pm
I noticed that the validator complains about the use of both "article" and "menu" when using HTML5 doctype..so I am not using those now. But it does makes some sense to use article for forum posts..though I am more inclined to use article on the whole subtemplate, that is: everything between header/footer templates and not just single posts.

"section" is also nice to use - or just plain ol' div. :)

EDIT: on Brad's comment that the original post might be best as "article" - that fits nicely with my work, since I use original post in several of the boardtypes, even lon in the topic since other posts are considered "comments" . Hm, must investigate further.
Title: Re: Semantics, HTML5, and other gruesomeness.
Post by: Antechinus on June 24, 2013, 06:07:53 pm
I still reckon it's a list of posts. :D

Agree article might fit for the OP of most threads, but when you get a string of posts that just contain a few smileys or a ROFL or two, calling them "articles" stretches the definition of the word to ridiculous extremes. In other words, it's bad semantics.

Anyway, like I said, it's only code junkies who are going to care. I doubt any of this is going to help a11y users at all. For instance, I know people on screen readers tend to navigate by h tags, so we should make sure there are enough of those, in the right places, and with a hierarchy that makes sense. That was an SMF fail, because SMF went straight from h1 to h3. There was never any h2.

Taking the board index as an example, h1 is up in the header. The next headings as such are the category header bars, so really they should be h2. The board name should be h3, with possibly an h4 on the last post link. Some way of grabbing the last post link quickly when you can't see it would be good.
Title: Re: Semantics, HTML5, and other gruesomeness.
Post by: Xarcell on June 28, 2013, 10:08:32 am
Quote from: Antechinus –
Quote from: TestMonkey –
(07:41:42 PM) groundup: Instead of <div class="windowbg2"> for posts change that to article. Instead of <a id="msg123"> change that to <article id="123"> add a class="unread" for unread posts
(07:42:00 PM) groundup: Just thought of that because of Aaron's PR
(07:45:41 PM) groundup: Use rel="author" for article authors


Um, hold the bus there. Before you get carried away with "It's a new HTML5 tag so I gotta use it", read the W3C definition of the article tag again.

Yes, they do suggest a forum post as one possible example, but the key point is that the article tag is intended to be used only for content which stands on its own, without being directly tied to other items.

This applies to forum posts sometimes, but it sure doesn't apply all the time. IOW, forum posts are not always (indeed, are frequently not) "articles" as defined by the HTML5 specs. Ergo, "article" is not the right way of marking them up, AFAICT.

I suggest that this be re-thought.

I agree that div is a useless tag in this context, so I had thought that (for the moment at least) it would make sense to go back to an idea that has been discussed before, namely marking up thread pages as an unordered list. After all, a thread page really is a list of posts, so that makes semantic sense to me.





ETA: I've been thinking about markup a lot lately. There are quite a few changes that I think would be beneficial, as well as being easy to implement. My intention is to start working on these too.

1/ .cat_bar, .title_bar - These suck. (http://www.councilofexmuslims.com/Smileys/custom/yes.gif)

The only reason .cat_bar and .title_bar went into 2.0.x markup was to enable supporting roundy bar ends in old versions of IE. Since we don't care about that any more, and since the divs have no semantic value, IMO those classes are superfluous.

They're not being used in the default styling at all now, and having thought about it I cannot see how removing them would restrict custom theming much, if at all. I could even easily do roundy bar ends in IE8 without those classes and without js patches.

2/ .catbg and .titlebg - These aren't much better.

First thing is that .catbg2 and .titlebg2 should defo be killed. They're very rarely used and getting rid of them is easy (have done on local).

As for the others (.catbg and .titlebg) the problem is they are too generic, which just ends up complicating the CSS. You often want different styling for table_grid headers and for other headers, so thumping them with the same classes makes no sense. It's just more stuff try and override.

Also, there's no semantic sense to these classes. At the moment .catbg can be either a category header, or a thread page header or a table column header, or several other things. Ditto for .titlebg. Then there's the whole "bg" thing, which would imply that .catbg provides backgrounds for entire categories, which it doesn't do at all.

I'm thinking these classes should be replaced with something like headerbar_h3, headerbar_h4, header_th, etc. This would make a lot more sense.

3/ Tables - Old classes not making much sense here either.

Leaving the headers aside for the moment, and just talking about the tbody stuff, with the new theme we're going for subtle zebra striping on rows. IMO, this is a well-proven way of making densely formatted tables more readable. For forum stuffz, I think it makes a lot more sense than colouring by column.

So that we have class names that do what they say on the tin, and so that we don't have to use efficiency abominations like tr.windowbg2, I think it would be best to use classes like .tablerow1 and .tablerow2. These should only be applied to the .table_grid class, not to any others. The board index and child boards already have their own styling for all cells, and nobody ever styles them by alternating rows.

4/ Which brings us to .windowbg and .windowbg2 - These are horrible too.

We all know what a window is. It's one of those things you open new stuff in, and can be resized and dragged and closed and whatever. That's what "window" means to most people online. Using .windowbg as a class name for something completely unrelated is semantic stupidity, IMO.

For the board index and child boards tables, there's no need for these classes. These tables already have CSS for every cell, and those cells already have their own individual classes. Imposing extra generic classes on top of those is just bonkers.

For the message index table, the same applies. Every cell already has its own class. The generic ones are just bloat, and just make markup and CSS more complex. They should be dropped.

These generic classes make no sense anywhere else either. For thread pages, if you want alternating classes it would make much more sense to use .postbg and .postbg2. I'm not even sure we need to provide for alternating classes in thread pages though, since frankly they seem to be out of fashion and IMHO are unlikely to return. Still, providing for them is fairly simple, but if we are going to do it it should be done by a sensible class.





Next bit: HTML5 stuffz.

Yes, it's all terribly exciting. However, there's still a lack of consensus in some areas as to how certain tags should be used in certain cases.

IMO, the first point to bear in mind is that, apart from code junkies, the only people who care about markup are blind people. Everyone else only cares about how it looks, not about how it runs. So, I'm mainly concerned about tag additions/changes that will enhance a11y for such people. If a change doesn't do that, I'm not that fussed about it.

My 2c is that we should use HTML5 tags where the use of a certain tag is unambiguous. For example, timestamps should use an HTML5 time tag. No worries.

Where the use of a tag is debatable, my 2c is that to save time and aggravation we should just do it old school (but still semantic). Once everything is more sorted, and once there's established consensus on tag usage, people can always look over the less-finished-than-it-is now product and suggest tag changes.


Interesting thoughts here. I would like to share my own...

Article tag should definitely be used. The W3C Spec (http://www.w3.org/TR/html5/sections.html#the-article-element) says this:

QuoteThe article element represents a component of a page that consists of a self-contained composition in a document, page, application, or site and that is intended to be independently distributable or reusable, e.g. in syndication. This could be a forum post, a magazine or newspaper article, a blog entry, a user-submitted comment, an interactive widget or gadget, or any other independent item of content.

"Syndication", "reuseable" and "form post" being the keys words here.

I agree that "catbg" and "titlebg" should not even be used anymore. It would be more appropriate to use the body class in conjunction with the header element. Example:

.action_messageindex h2, .action_home h2, .action_search h2 {
  background: green;
}

Table classes should definitely be addressed. They are still the only thing within the stylesheet file that I find confusing at times.

As far as the windowbg and windowbg2, I think they should be renamed to "content_bg" and "post_bg", not "postbg" and "postbg2", because not all areas which use the class is a post. I personally hate using numbers in classes unless it's semantically necessary such as a board number or topic number. Note, that you could also use "content_stn", "content_alt", and "post_stn" "post_alt" for more added flexibility(stn = standard).
Title: Re: Semantics, HTML5, and other gruesomeness.
Post by: TestMonkey on June 28, 2013, 10:14:24 am
Quote from: Xarcell – As far as the windowbg and windowbg2, I think they should be renamed to "content_bg" and "post_bg", not "postbg" and "postbg2", because not all areas which use the class is a post.
Wouldn't that be, "content_bg" and "content_bg2"? Just wondering (I have no issue with any), because I'm not sure I see the (consistent) meaning otherwise.
Title: Re: Semantics, HTML5, and other gruesomeness.
Post by: Xarcell on June 28, 2013, 10:24:18 am
To add to some of the comments here. Article tags, Section tags, H1 tags, and others can all be used several times within a web page and it's still semantic. As far as the first post, that's what microdata(schema.org) is for: itemscope="" itemtype="http://schema.org/Article" should be used on the first post, while comments to that first post should have "http://schema.org/UserComments"

See, a bot recognizes good semantics for SEO, however it has no idea what the first post is. So it doesn't help anymore to use only the article tag for only the first post. If the bot was any smarter, it would be wondering why it wasn't used for the rest of the posts, because all of it's content is unique. It should be used for all posts, just as the spec says. If you want an indexing bot to understand the difference between a actual article and it's comments, you use the microdata.
Title: Re: Semantics, HTML5, and other gruesomeness.
Post by: Xarcell on June 28, 2013, 10:26:25 am
Quote from: TestMonkey –
Quote from: Xarcell – As far as the windowbg and windowbg2, I think they should be renamed to "content_bg" and "post_bg", not "postbg" and "postbg2", because not all areas which use the class is a post.
Wouldn't that be, "content_bg" and "content_bg2"? Just wondering (I have no issue with any), because I'm not sure I see the (consistent) meaning otherwise.

Ant's suggestion was to use "postbg" and "postbg2", that's why I said that. As I said before, I agree they should be changed, but I also believe number's should not be used. That's why I suggested "content_stn" and "content_alt"...
Title: Re: Semantics, HTML5, and other gruesomeness.
Post by: TestMonkey on June 28, 2013, 10:34:10 am
Ah okay, sorry (I partially misunderstood). Thanks.
Title: Re: Semantics, HTML5, and other gruesomeness.
Post by: Antechinus on June 28, 2013, 04:34:07 pm
Yeah, I know, but as I said their spec (which is nightly, not final) actually contradicts itself a bit, if you think about how forum posts often are in reality (IOW, not really stand alone items that would make sense out of their original context). If a convention develops where the article tag is used regardless of how much sense the content makes as an independently distributed item, then ok sure. At the moment it just seems a bit daft to me.

To my mind, the thread page is still a list of posts. That makes semantic sense to me on all levels. My 2c.


QuoteI agree that "catbg" and "titlebg" should not even be used anymore. It would be more appropriate to use the body class in conjunction with the header element. Example:

.action_messageindex h2, .action_home h2, .action_search h2 {
  background: green;
}
I'm trying to get away from descendant selectors as much as possible. Anyone whose coding is up to it can of course still write whatever they like, but for ease of customisation for n00bs I'm trying to give them a structure that primarily relies on clearly understandable class names and id's. Not full-on mental "OOCSS", but sorta tending in that direction.


QuoteAs far as the windowbg and windowbg2, I think they should be renamed to "content_bg" and "post_bg", not "postbg" and "postbg2", because not all areas which use the class is a post. I personally hate using numbers in classes unless it's semantically necessary such as a board number or topic number. Note, that you could also use "content_stn", "content_alt", and "post_stn" "post_alt" for more added flexibility(stn = standard).
I'd prefer to not use "_stn" as it's not immediately clear in meaning. I brings to mind "station" for me. My plan is to just use the standard classes without underscored suffixes, and add "_alt" to the alternate ones. I think that is clearer, as well as being slightly less verbose.

But yeah, "window" is bonkers and should be killed.
Title: Re: Semantics, HTML5, and other gruesomeness.
Post by: Antechinus on June 29, 2013, 07:34:32 pm
Grmmpph.

/me just wants to go back to using nested tables for everything................ :D

Ok, not really. Can't stand nested tables. Been reading around a bit more, and thinking about stuff I've read. If the convention is that article gets used for forum posts, regardless of whether it would be an appropriate term for many forum posts from the perspective of the average English speaker*, then something like this seems like good markup for thread pages.

http://coding.smashingmagazine.com/2009/08/04/designing-a-html-5-layout-from-scratch/

Specifically, an adaption of this part:
<section id="content" class="body">
 
<ol id="posts-list" class="hfeed">
 
<li><article class="hentry">
<header>
<h2 class="entry-title"><a href="#" rel="bookmark" title="Permalink to this POST TITLE">This be the title</a></h2>
</header>
 
<footer class="post-info">
<abbr class="published" title="2005-10-10T14:07:00-07:00"><!-- YYYYMMDDThh:mm:ss+ZZZZ -->
10th October 2005
</abbr>
 
<address class="vcard author">
By <a class="url fn" href="#">Enrique Ramírez</a>
 
</address>
</footer><!-- /.post-info -->
 
<div class="entry-content">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque venenatis nunc vitae libero iaculis elementum. Nullam et justo <a href="#">non sapien</a> dapibus blandit nec et leo. Ut ut malesuada tellus.</p>
 
</div><!-- /.entry-content -->
</article></li>

<li><article class="hentry">
...
</article></li>
 

<li><article class="hentry">
...
</article></li>
</ol><!-- /#posts-list -->
 
</section><!-- /#content -->

Not that I would do it identically for Elk, do to the way the gui is arranged, but the basic structure of an ol framework holding article tags makes sense to me. I was thinking of ul originally, but then the definition of ol makes more sense (ie: use ol where changing the order would scramble the meaning of the list).


* The sort of thing I'm thinking of is where you get a succession of posts that are just smileys, or one line replies to something that was said earlier (without linked quotes to the original post) or whatever. Things like that don't meet the definition of "article", either in W3C terms or in terms of common English usage. IOW, calling them articles is bad use of language, which is another way of saying it is bad semantics.
Title: Re: Semantics, HTML5, and other gruesomeness.
Post by: Antechinus on June 29, 2013, 07:51:05 pm
And while I think of it, board index categories are going to be marked up like this (stripped most of the php for brevity):

Code: [Select]
		<section class="forum_category" id="category_', $category['id'], '">

<h2 class="category_header">';
<a class="collapse" href="#" title="">', $category['collapse_image'], '</a>
The usual board name....
</h2>

<ul class="category_boards" id="">';

<li class="board_row ', (!empty($board['children'])) ? 'parent_board':'', '" id="">
<div class="board_info">

<a class="icon_anchor" href="#">
<img class="board_icon" src="on.png" alt="" title="" />
</a>

<h3 class="board_name">
<a href="', $board['href'], '" id="b', $board['id'], '">
The usual board name....
</a>
</h3>

<p class="board_description">
Board description stuffz...
</p>

<p class="board_moderators">
The usual list of mods....
</p>

</div>

<div class="board_latest">

<p class="board_stats">
Post count...
Topic count...
</p>

<p class="board_lastpost">
Timestamp, post title, etc...
</p>

</div>
</li>

<li class="childboard_row">
<h4>', $txt['parent_boards'], ':</h4>
<ul class="childboards"> The usual list of child boards... </ul>
</li>

</ul>

</section>
Title: Re: Semantics, HTML5, and other gruesomeness.
Post by: Bloc on June 30, 2013, 05:27:09 am
I read a very interesting article about HTML5 , that at least changed my view a bit on how to approach things. It seems that section tags are way more important than I thought, and article,header,footer aren't the typical "for the whole page" kind of tags - but rather can be elements in each section tag.

I am sure Antech knows about it. :) But it was news to me, although I wondered often how to really outline headers etc. when you got 3 side-by-side panels - what order is semantically correct and if you change the order, will one be the parent of another then. It seems not. Need to read his e-book about this.

http://www.webdesignerdepot.com/2013/01/the-harsh-truth-about-html5s-structural-semantics-part-1/
http://www.webdesignerdepot.com/2013/01/the-harsh-truth-about-html5s-structural-semantics-part-2/
http://www.webdesignerdepot.com/2013/01/the-harsh-truth-about-html5s-structural-semantics-part-3/
Title: Re: Semantics, HTML5, and other gruesomeness.
Post by: Antechinus on June 30, 2013, 06:11:56 am
Y'know, this part from the first link, about halfway down the page, really hits the nail on the head IMO.

QuoteThe problem is, if you read the actual HTML5 specification, the elements in HTML5 are defined in a way that has little to do with how we have traditionally used them.

On the one hand, Hickson has introduced a whole new concept of structuring a web page in HTML5 with sectioning elements. On the other, Hickson is comparing his HTML5 sectioning elements to classes used in the wild with no understanding of what those classes were actually used for.
Title: Re: Semantics, HTML5, and other gruesomeness.
Post by: Antechinus on June 30, 2013, 06:50:04 am
Hey this bloke makes one hell of a lot of sense. Take his points about the h1-h6 tags. These points are entirely valid, IMO. I've been thinking the same thing myself. The specs do not take a11y and presentation* into account, which is another way of saying they don't consider how people actually want to use the web.


QuoteHTML5 wants to be backwards compatible, so the WHATWG decided not to introduce an h element (despite introducing a bunch of new sectioning elements), and instead wants to repurpose the h1 element to be the generic h element. Use h1 everywhere, and let the HTML5 outlining algorithm determine its true level… or so the theory goes.

This is a terrible idea for several reasons, the two main ones being accessibility and styling.

Accessibility

Using h1 everywhere is very bad for accessibility. Blind users rely heavily on the heading structure of a site. It’s important for all of us to be reminded of just how crucial heading structure is for accessibility purposes. For instance, a December 2008 survey of over 1000 screen reader users conducted by WebAIM found that 76% of blind and vision-impaired users ‘always or often’ navigated by headings when they were available. And a May 2012 survey found that 82.1% heading levels were ‘very useful’ or ‘somewhat useful’ when navigating a web page. (This is good, practical research, so take note.)

<snip>

Styling

But it gets worse. Lets say we want to run with a pure HTML5 outline, and we use h1s everywhere. Remember, in the HTML5 spec the h1 is just a generic h element; its real level is determined by how deeply its nested in sectioning elements.

So how do we style it? Well, we could add class names to all our h1 elements so we can pick them out, but that is contrary to the stated HTML5 goal of simplifying authoring; and we may as well stick to h1-h6 (all of which are treated as generic h elements in a HTML5 outline).

Here’s the generic style for an h3 element:

Code: [Select]
article aside nav h1, article aside section h1, 
 article nav aside h1, article nav section h1,
 article section aside h1, article section nav h1, article section section h1,
 aside article nav h1, aside article section h1,
 aside nav article h1, aside nav section h1,
 aside section article h1, aside section nav h1, aside section section h1,
 nav article aside h1, nav article section h1,
 nav aside article h1, nav aside section h1,
 nav section article h1, nav section aside h1, nav section section h1,
 section article aside h1, section article nav h1, section article section h1,
 section aside article h1, section aside nav h1, section aside section h1,
 section nav article h1, section nav aside h1, section nav section h1,
 section section article h1, section section aside h1, section section nav h1, section section section h1 {
    font-size: 1.00em;
 }

Yet that’s what HTML’s structural elements give us. What a mess.

*Meaning not just "eye candy", but good layout and typography that actually makes for easier reading and comprehension.
Title: Re: Semantics, HTML5, and other gruesomeness.
Post by: Antechinus on June 30, 2013, 06:56:17 am
Oh FFS. This is mental:

QuoteIt’s reasonable to suggest that perhaps user agents in the future, such as browsers and screen readers, will do more with HTML5′s structural elements, and that will make them more palatable to us as authors.

Opera’s Bruce Lawson suggested just that on the WHATWG mailing list in 2009:

    "After all, I know of no user agents that can use time, section, footer, datagrid etc but we mostly expect there to be soon.“

And here’s what Hickson, the HTML5 editor, said in reply:

   " I don’t. Most of the new elements are just meant to make styling easier, so that we don’t have to use classes.“

All that, and the editor doesn’t see user agents ever even using these elements. They are there, he says, to save us from using classes. Put another way, the creator of these elements seems unsure why they’re even in the spec, save ‘making styling easier’.

That is pure idiocy. He obviously hasn't given any thought at all as to how web pages are actually styled. His mindset would lead directly to the CSS abominations quoted in my previous posts. Using the same elements (h1, section, article, whatever) all over pages is EXACTLY when you DO want to assign individual classes for each separate usage. Not doing so makes for horrendously inefficient CSS selectors, and inpenetrable code that is a nightmare to write, debug and to maintain.


ETA: Ha. I like this bloke. :D

QuoteConclusions

Let’s wrap up with some conclusions.

    Headings matter: first, we should really care about the heading structure of our pages to help out blind and vision-impaired users trying to get around with screen readers. The venerable h1-h6 elements may be limited, but they’re relied on heavily by screen reader users.

    HTML5 structure is a mess: we should probably ignore HTML structural elements altogether. They’ve been a bit of a disaster — we have essentially forked the spec, created plenty of broken outlines, and wasted too much time already trying to get our heads around a fundamentally broken system. Long live divs.

    Consider ARIA landmarks: adding ARIA landmarks to your site is another simple, effective way of helping screen reader users.

    Consider schema.org and the future of semantics: schema.org has the backing of the major search engines, and while it’s certainly a mixed bag at the moment, it seems to be future for structured data on the web.

There are lots of good parts in the HTML5 specification, from new forms features to the History API and Canvas implementation. In fact, without the WHATWG, who have been the driving force behind HTML5, we’d still be stuck with HTML4/XHTML 1.0 while we waited for the W3C to get their act together. Nevertheless, just because HTML5 and all the related technology around it is new and exciting, it doesn’t mean we have to accept everything we’re given.

Sometimes it’s worth seeing how the HTML sausage is made, so we know what we’re eating. And in the case of HTML’s structural semantics, I’d rather pass.
Title: Re: Semantics, HTML5, and other gruesomeness.
Post by: Antechinus on June 30, 2013, 08:05:40 am
Someone find me a huge animated ROFLMAO smiley. I bought this bloke's book (cheap as chips, and worth every cent) and am going through it.

A good example is the new header and footer tags. I did notice that someone has gone and applied these to Elk's index.template.php, in the places where you would expect them. The header tag is up where we have what we'd normally call the header. The footer tag is down at the bottom of every page, where the copyright and stuff is.

Whoever did this probably thought they were being avant garde and terribly semantic. One small problem.

It completely contravenes the HTML5 specifications.

QuoteLet me give you an example.

The spec says <header> and <footer> elements
define areas within a section, but do not define sections themselves, and so won’t
show up in a document outline.

This is something most people get wrong,
including those teaching HTML5 through books and blogs, whose examples
often show <header> being on par with <section>

 The spec also says
<header> and <footer> can be used multiple times per page (once per section,
for example), but you would never pick that up from most HTML5 resources out
there.

These may seem like pedantic, wonkish points. But they illustrate something
very serious—the community is trying to implement HTML5 markup in a way
that doesn’t have much relation to the actual HTML5 spec. It’s a weird inbetween
state of markup limbo that has inadvertently appeared because that’s
what everyone assumed these elements should be used for.
Title: Re: Semantics, HTML5, and other gruesomeness.
Post by: Bloc on June 30, 2013, 11:13:05 am
Exactly! :)

I am liking this guy's thoughts as well, it makes totally sense, and reveals stuff that have gone under of the radar of most I suspect. Bought it too, but haven't had time to read it yet(family demanded I dragged myself away from the screen and out into the sunshine. they were hungry you see, and i am the designated barbecue-chief around here 8) )
Title: Re: Semantics, HTML5, and other gruesomeness.
Post by: Antechinus on June 30, 2013, 05:43:14 pm
ROFL. Bucketing down rain here. Barbecues are not currently on my agenda, so have read book. :D

It has just confirmed what I had already suspected. The markup examples on the W3C site do not pass my sniff test. They smell bad, but I had assumed that hey, there must be some awesomely justifiable rationale behind them, basically because "ZOMG! HTML5! ZOMG! New! ZOMG! Spexxxxxxxxxx!".

Having done some pretty serious swotting up over the last several days, I can now say that I now thoroughly understand the new specs, at least as they relate to the basic structural markup we need for this project, and that also means I now thoroughly understand why the new specs smell bad.

It's because they are bad. Seriously.

I'm here to give Elk the best markup and CSS that I can write. With that in mind, I have a totally serious proposal to make.

I propose that <header>, <footer>, <nav>, <article>, <aside> and <section> be banned from the Elk repo.

Why? Simple. Using those tags will...

1/ ...do nothing to improve page performance.

2/ ...do nothing to improve SEO. The major search engines have shown very clearly that what they want is Schema.org. They don't care about the new HTML5 tags, any more than they care about meta keywords.

3/ ...do nothing to improve the comprehensibility of either markup or CSS.

4/ ...do nothing to improve accessibility and, in fact, will...

5/ ...actually do a lot to break accessibility. Yes, really.

6/ ...do nothing to improve ease of customisation and , purely because of the convoluted markup they will demand if used according to the specs, and the implications of that, will...

7/ actually make good customisation harder.
Title: Re: Semantics, HTML5, and other gruesomeness.
Post by: emanuele on July 01, 2013, 01:18:10 pm
/me is tempted to push the "like" button...

NO! Better write it. :+1: (/me thinks we need a :+1: smiley :P)
Title: Re: Semantics, HTML5, and other gruesomeness.
Post by: TE on July 01, 2013, 01:54:22 pm
Quote from: emanuele – /me is tempted to push the "like" button...

NO! Better write it. :+1: (/me thinks we need a :+1: smiley :P)
yep, agree (http://freesmileyface.net/smiley/signs/plus-one-2.gif) LOL..
and a thumbsup smiley please..
(http://www.smfportal.de/Smileys/default/welldone.gif)
Title: Re: Semantics, HTML5, and other gruesomeness.
Post by: emanuele on July 01, 2013, 02:02:28 pm
BTW: I have no idea what I plused to. :P
Title: Re: Semantics, HTML5, and other gruesomeness.
Post by: Bloc on July 01, 2013, 04:57:40 pm
Been reading on ... Seems using as few as the new HTML5 tags as possible(at least the header/footer/article/section/aside etc. bits) and rather use ARIA for creating a proper ordering for screenreaders, is the way to go. Plus headers of course. Schemas are also useful. And I find the use of canvas interesting, not the least in creating for example flow-charts.

However, after reading more the author thinks javascript will be equally important for adding effects that some of the new tags are supposed to be alternatives for(so stick with JS rather than betting on the tags), meaning using well-tested libraries like JQuery is a  must. (in my case Mootools)

Very interesting!
Title: Re: Semantics, HTML5, and other gruesomeness.
Post by: Antechinus on July 01, 2013, 05:56:09 pm
Yeah. There's some good stuff in the spec that we can use. Things like the new input types are fine, because any browser that doesn't support them just falls back to rendering then as standard text inputs. That means we can get some nice little benefits for some users there. We can also clean up some crud like doctypes and css/js file calls, due to the neater syntax HTML5 allows there. I'm sure there's going to be other things we can use too.

Re the structural tags: the really problematic ones for a11y are article, section and aside. Those are problematic because they will break a11y for screen readers. Given that they provide absolutely no benefits to any other users, I think it would frankly be stupid to use them at all. So, we should avoid them like the plague.

Header, footer and nav are not so problematic. The only people they are likely to cause problems for are IE8 users with js disabled. The thing is though that, like the other elements, they do not actually provide an advantages. So, including them will break things badly for a very small group of users, without doing anything at all to help the others. Including them also requires us to feed a special js file to IE8 users, which is code we otherwise wouldn't need. So, I have to wonder why we would bother with those tags.

My 2c is that to give the most usability for the most people, and to keep our codebase as simple as possible, we just ignore most of the new tags. There's nothing forcing us to use them, and it seems that there are distinct practical advantages to not using them.

To get better a11y, we just have to use the ARIA stuff properly (which I had already started on anyway). To get better SEO, we use schema.

ETA: Ok, having formulated a strategy, at least for myself, I can get back to coding. :D What I am going to do is just stick to marking things up basically in XHTML Transitional style. I'll ignore most HTML5 tags, and just stick with what will work for everyone.

If I'm working on a template and see a new tag where I think it's inappropriate, I'll just remove it and substitute something else.
Title: Re: Semantics, HTML5, and other gruesomeness.
Post by: Joshua Dickerson on December 27, 2015, 08:50:41 pm
Reviving this discussion since https://github.com/joshuaadickerson/Elkarte/tree/OpenGraph