Variable Order

A fascinating little tech demo by Roman Komarov that allows for clickable table sorting entirely in CSS. It’s a combination of inline CSS custom properties, the order property, and calc().

This demo sparked a ton of conversation about accessibility, the crux of which is that the reordering is done only visually and not in the source. Which means that someone interacting directly with the source (a screen reader) might be mislead into thinking they’ve sorted the table when they haven’t. Rachel Andrew pointed out that it’s actually one of the rare things the spec itself tells you not to do:

Authors must use order only for visual, not logical, reordering of content. Style sheets that use order to perform logical reordering are non-conforming.

As a connoisseur of fine CSS trickery, I applaud the idea. In production, still a job for JavaScript. And about that order property? Is it always a bad idea to use? Amelia Bellamy-Royds has a post with a pretty good use case. And Adrian Roselli’s HTML Source Order vs CSS Display Order covers the struggle.

Direct Link to ArticlePermalink

Variable Order is a post from CSS-Tricks