Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ivan 165 posts 543 karma points
    Apr 17, 2014 @ 09:18
    Ivan
    1

    RegisterStyleSheetFile breaks WCAG AA.

    Hi.

    When you call the umbraco.library.RegisterStyleSheetFile('MyStyle', 'mystyle.css') method, it produces the following markup:

    <link id="ContentPlaceHolderDefault_MyStyle" rel="stylesheet" type="text/css" href="mystyle.css"></link>

    That breaks WCAG AA standard with this message: "E603 An end tag is not allowed for this element."

    Any thought on how to avoid the closing tag?

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Apr 17, 2014 @ 12:30
    Jan Skovgaard
    0

    Hi Ivan

    In what situation are you using the extension to add the stylesheet? Perhaps you could switch to using yepnope.js instead?

    I agree that it should of course just give an self-closing tag but I suspect it's something in the .NET framework that is outputting it this way. But does that WCAG validation matter that much? I mean...does it affect the potential disabled users visiting the site...if it does of course then it should be fixed somehow. But if it does not affect real people but is just a validation tool that can't tell what's important or not then I don't really see the issue.

    Hope this helps.

    /Jan

  • Ivan 165 posts 543 karma points
    Apr 17, 2014 @ 13:30
    Ivan
    0

    Thanks, Jan.

    The WCAG issue does matter for the project sake (it was agreed that the project would be clean against WCAG errors). Although I agree, that this particular issue doesn't affect disabled usres much.

    The YepNope script would be hard to use in our scenario because it involevs to much effort (especially in testing) as it's called from many diffirent templates (both XSLT and Razor).

    I'll try to figure out what would be the best way to solve the problem programmatically.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Apr 17, 2014 @ 13:38
    Jan Skovgaard
    1

    Hi Ivan

    Ok, perhaps you can create your own XSLT extension to include the CSS then and make sure that the tag is closed correctly?

    /Jan

  • Ivan 165 posts 543 karma points
    Apr 22, 2014 @ 18:56
    Ivan
    101

    Hi Jan.

    What I did was calling the following method on Page_PreRender in Master template:

        private void UncloseLinkTags()
        {
            var sw = new System.IO.StringWriter();
            var hw = new HtmlTextWriter(sw);
     
            Page.Header.RenderControl(hw);
            Page.Header.InnerHtml = sw.GetStringBuilder().ToString().Replace("></link>", ">").Replace("<head>", "").Replace("</head>", "");
        }
     

    That would do the trick and, most importantly, I had to make changes in a single place only.

    Thanks for you help here!

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Apr 22, 2014 @ 21:23
    Jan Skovgaard
    0

    Hi Ivan

    Very happy to see you found a workaround and thanks for sharing so others can benefit from it :)

    /Jan

Please Sign in or register to post replies

Write your reply to:

Draft