Modul:Navbox: Unterschied zwischen den Versionen

aria-labelledby fallbacks: title, otherwise above, otherwise lone group
((1) add tracking for css borders in group/above/belowstyle (2) extended background colour check to above and belowstyle (3) add Johnuniq's change to enable using this module directly in Navbox subgroup)
(aria-labelledby fallbacks: title, otherwise above, otherwise lone group)
Zeile 134: Zeile 134:
titleCell
titleCell
:tag('div')
:tag('div')
-- id for aria-labelledby attribute
:attr('id', mw.uri.anchorEncode(args.title))
:attr('id', mw.uri.anchorEncode(args.title))
:addClass(args.titleclass)
:addClass(args.titleclass)
Zeile 163: Zeile 164:
:attr('colspan', getAboveBelowColspan())
:attr('colspan', getAboveBelowColspan())
:tag('div')
:tag('div')
-- id for aria-labelledby attribute, if no title
:attr('id', args.title and nil or mw.uri.anchorEncode(args.above))
:wikitext(processItem(args.above, args.nowrapitems))
:wikitext(processItem(args.above, args.nowrapitems))
end
end
Zeile 201: Zeile 204:
if args['group' .. listnum] then
if args['group' .. listnum] then
local groupCell = row:tag('th')
local groupCell = row:tag('th')
-- id for aria-labelledby attribute, if lone group with no title or above
if listnum == 1 and not (args.title or args.above or args.group2) then
groupCell
:attr('id', mw.uri.anchorEncode(args.group1))
end


groupCell
groupCell
Zeile 398: Zeile 407:
:attr('role', 'navigation')
:attr('role', 'navigation')
:node(tbl)
:node(tbl)
if args.title then
-- aria-labelledby title, otherwise above, otherwise lone group
nav:attr('aria-labelledby', mw.uri.anchorEncode(args.title))
if args.title or args.above or (args.group1 and not args.group2) then
nav:attr('aria-labelledby', mw.uri.anchorEncode(args.title or args.above or args.group1))
else
else
nav:attr('aria-label', 'Navbox')
nav:attr('aria-label', 'Navbox')
Zeile 419: Zeile 429:
:css('padding', '3px')
:css('padding', '3px')
:node(tbl)
:node(tbl)
if args.title then
-- aria-labelledby title, otherwise above, otherwise lone group
nav:attr('aria-labelledby', mw.uri.anchorEncode(args.title))
if args.title or args.above or (args.group1 and not args.group2) then
nav:attr('aria-labelledby', mw.uri.anchorEncode(args.title or args.above or args.group1))
else
else
nav:attr('aria-label', 'Navbox')
nav:attr('aria-label', 'Navbox')
Anonymer Benutzer