Module:Navbox: Difference between revisions
Content added Content deleted
m (1 revision imported) |
Enwikipedia>Matt Fitzpatrick (aria-labelledby fallbacks: title, otherwise above, otherwise lone group) |
||
Line 134: | Line 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) |
||
Line 163: | Line 164: | ||
:attr('colspan', getAboveBelowColspan()) |
:attr('colspan', getAboveBelowColspan()) |
||
:tag('div') |
:tag('div') |
||
-- id for aria-labelledby attribute, if no title |
|||
⚫ | |||
:wikitext(processItem(args.above, args.nowrapitems)) |
:wikitext(processItem(args.above, args.nowrapitems)) |
||
end |
end |
||
Line 201: | Line 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 |
|||
⚫ | |||
end |
|||
groupCell |
groupCell |
||
Line 398: | Line 407: | ||
:attr('role', 'navigation') |
:attr('role', 'navigation') |
||
:node(tbl) |
:node(tbl) |
||
-- aria-labelledby title, otherwise above, otherwise lone group |
|||
if args.title then |
|||
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') |
||
Line 419: | Line 429: | ||
:css('padding', '3px') |
:css('padding', '3px') |
||
:node(tbl) |
:node(tbl) |
||
-- aria-labelledby title, otherwise above, otherwise lone group |
|||
if args.title then |
|||
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') |