A about/acending.wav => about/acending.wav +0 -0
A about/acending.wav.mime => about/acending.wav.mime +1 -0
@@ 0,0 1,1 @@
+audio/vnd.wav
A about/descending.wav => about/descending.wav +0 -0
A about/descending.wav.mime => about/descending.wav.mime +1 -0
@@ 0,0 1,1 @@
+audio/vnd.wav
M src/Table.hs => src/Table.hs +20 -1
@@ 38,7 38,7 @@ applySort' id' asc col el@Element { elementAttributes = attrs, elementNodes = ch
applySort'' asc col el
| Just sortable <- table2sorttable el = el {
- elementNodes = header ++
+ elementNodes = annotateTHead header asc col ++
(L.concatMap (L.map NodeElement . markup) $ L.sortBy compareRows sortable)
++ footer
}
@@ 83,6 83,25 @@ splitTableBody els@(NodeElement _:_) = ([], els)
splitTableBody (_:els) = splitTableBody els
splitTableBody [] = ([], [])
+annotateTHead (NodeElement el@Element { elementName = Name "thead" _ _, elementNodes = childs }:nodes) a c =
+ NodeElement el { elementNodes = annotateTHead childs a c } : nodes
+annotateTHead (NodeElement el@Element { elementName = Name "tr" _ _, elementNodes = childs }:nodes) a c =
+ NodeElement el { elementNodes = annotateTR childs a c 0 } : nodes
+annotateTHead (child:childs) a c = child:annotateTHead childs a c
+annotateTHead [] _ _ = []
+
+annotateTR (NodeElement el@Element { elementName = Name n _ _, elementAttributes = attrs }:nodes) asc col count
+ | n `elem` ["th", "td"], count >= col =
+ NodeElement el { elementAttributes = M.insert "aria-sort" asc' attrs }:nodes
+ | n `elem` ["th", "td"] = NodeElement el:annotateTR nodes asc col (count + colspan)
+ where
+ colspan = fromMaybe 1 (readMaybe =<< unpack <$> M.lookup "colspan" attrs')
+ attrs' = M.mapKeys nameLocalName attrs
+ asc' | asc = "ascending"
+ | otherwise = "descending"
+annotateTR (node:nodes) a c n = node:annotateTR nodes a c n
+annotateTR [] _ _ _ = []
+
trs2sorttable els@(el@Element { elementName = Name "tr" _ _, elementNodes = childs }:_)
| Just keys' <- tds2keys [el | NodeElement el <- childs],
Just (group, rest) <- groupTrs els 1,
M useragent.css => useragent.css +3 -1
@@ 126,5 126,7 @@ details:target > *, details[open] > * {speak: always}
- Dutch
- Spanish */
-/** ARIA */
+/** ARIA **/
[aria-hidden] {speak: never}
+th[aria-sort=ascending] {cue-before: url(about:ascending.wav)}
+th[aria-sort=descending] {cue-after: url(about:descending.wav)}