Sunday, October 10, 2004

Keyboard navigation on Original, CSS rant

I finally managed to fix the remaining issues in my modified original, and as a bonus I added keyboard navigation on the preview screen.

Keyboard navigation makes it soooo much handy to skip to the next/previous photos, but I wondered for a while about how to inform the user that she can use the keyboard, as right now, keyboard navigation on the web is so underused, that it even feels weird to just press the right arrow to skip to the next picture.

I decided to add little explicit hint on the webpage saying that you can use the arrow keys, and to make it disappear when the user starts using the keyboard. All that coupled with a little bit of javascript magic to store if we should show the hint in a cookie, and we're done.

While I was at it, I also removed the alternative stylesheets, because it made the code that managed the cookies a bit harder, and I wanted to remove them anyway, as I didn't know how well they played with the new html.

I will call it a day.

Oh, I almost forgot...

<rant>
I am, as anybody, jumping in the CSS bandwagon. Pages are smaller and presentation is much more separated from HTML than when you layout with tables.

But it certainly is not the best thing since sliced bread.

The whole goal of CSS is to be a language where you can specify the layout and the look of HTML elements. It fails short on the look part, and it's a disaster on the layout part.

While you can certainly work out alternative layouts to a web page (Zen Garden probably being the famoust example), the language is certainly not stellar at doing it.

I will bet that, without reading in Internet how to do it, and with a good knowledge of CSS, you will not be able to layout a simple page, with just a header, footer and a left band. In fact, the best you can do is something that looks like this layout, carefully using a background image on certain areas to give the impression of this layout to the user.

Thing are so bad, that you will even have to change the logical HTML, adding some spurious div's to make it work on all browsers. If I find something like this in a computer program, I will call it on a blink of an eye a hack.

These layouts (2 columns, 3 columns, etc.) are so hard to discover, that when you come with a way to do it, you're internationally aclaimmed, articles are written and much (virtual) ink flows about it. And that's the thing CSS was supposed to do so well.

It is embarrassingly easy to do the same layout using (horror!) tables.

On the look side, things definitively look better. You can change
much easily than before the look of your page using HTML, but it also makes it ring a bell in my head when I see the proliferation of ad-hoc'ist pseudo-classes in CSS, to specify the dynamic look of some elements to get a pale imitation of what we can do right now with JavaScript (and I will be complaining much harder if cross browser JavaScript was less painful).
</rant>