• Resolved arthurch

    (@arthurch)


    The plugin shortcode adds a <style> tag outside of the <head> element, which causes the html validation to fail, so we can’t be WCAG 2.1 compliant.

    Example of failure on https://validator.w3.org/

    Error: Element style not allowed as child of element div in this context. (Suppressing further errors from this subtree.)
    
    From line 879, column 1; to line 879, column 23
    
        <div>↩<style type="text/css">↩<!--↩
    
    Contexts in which element style may be used:
    Where metadata content is expected.
    In a noscript element that is a child of a head element.
    Content model for element div:
    If the element is a child of a dl element: one or more dt elements followed by one or more dd elements, optionally intermixed with script-supporting elements.
    If the element is not a child of a dl element: flow content.
Viewing 1 replies (of 1 total)
  • Plugin Author Prisna

    (@prisna)

    Greetings,

    While the validation is correct, that doesn’t mean the site won’t work and/or visitors will face problems when accessing the site. The w3 validator is a great tool, but it became obsolete over 10 years ago with the evolution of browsers. Nowadays tools like gtmetrix are being widely used, as they target speed and performance.

    In order to have the styling in the header, we’ll need to use more processes and sentences, and that will make the plugin slower. Not much slower, but slower indeed and without any real benefit. Other Google Translate plugins simply place their CSS code in an external file, that will keep the w3 validator happy, but at the expense of performance. And this is one point in which our plugin differs from others, speed and zero unnecessary requests.

    However, we could add a setting to let the user choose where to place the CSS within the HTML code. But sorry, can’t really tell when it’b be available. If compliance is required for your site, then you’ll need to use a different plugin for now.

    Regards

Viewing 1 replies (of 1 total)

The topic ‘Plugin produces invalid HTML’ is closed to new replies.