Module:Navbox: Difference between revisions
navigation div instead of single-cell table wrapper
m>Izkala (Kill nowikis) |
m>Matt Fitzpatrick (navigation div instead of single-cell table wrapper) |
||
Line 116: | Line 116: | ||
titleCell | titleCell | ||
:tag('div') | |||
:attr('id', mw.uri.anchorEncode(args.title)) | |||
:addClass(args.titleclass) | |||
:css('font-size', '114%') | |||
:wikitext(addNewline(args.title)) | |||
end | end | ||
Line 360: | Line 361: | ||
local res = mw.html.create() | local res = mw.html.create() | ||
if border == 'none' then | if border == 'none' then | ||
res:node(tbl) | local nav = res:tag('div') | ||
:attr('role', 'navigation') | |||
:node(tbl) | |||
if args.title then | |||
nav:attr('aria-labelledby', mw.uri.anchorEncode(args.title)) | |||
else | |||
nav:attr('aria-label', 'Navbox') | |||
end | |||
elseif border == 'subgroup' or border == 'child' then | elseif border == 'subgroup' or border == 'child' then | ||
-- We assume that this navbox is being rendered in a list cell of a parent navbox, and is | -- We assume that this navbox is being rendered in a list cell of a parent navbox, and is | ||
Line 370: | Line 378: | ||
:wikitext('<div>') -- XXX: hack due to lack of unclosed support in mw.html. | :wikitext('<div>') -- XXX: hack due to lack of unclosed support in mw.html. | ||
else | else | ||
res | local nav = res:tag('div') | ||
:attr('role', 'navigation') | |||
:addClass('navbox') | |||
:cssText(args.bodystyle) | |||
:cssText(args.style) | |||
:css('padding', '3px') | |||
:node(tbl) | |||
if args.title then | |||
nav:attr('aria-labelledby', mw.uri.anchorEncode(args.title)) | |||
else | |||
nav:attr('aria-label', 'Navbox') | |||
end | |||
end | end | ||