Module:Navbox: Difference between revisions

    imported>MacFan4000
    m (1 revision imported)
    en>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
    :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
    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
    :attr('id', mw.uri.anchorEncode(args.group1))
    end


    groupCell
    groupCell
    Line 398: Line 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')
    Line 419: Line 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')