• Resolved csmestar

    (@csmestar)


    Hi,

    We use GDPR Cookie Compliance 5.2.2 on WordPress 7.1, with the “tabs” modal layout. The W3C HTML validator reports two errors that come from the plugin’s output. Both have small fixes.

    1. Tab panels are missing role="tabpanel"

    In gdpr-modules/modal/tab-navigation.php, each tab button has role="tab" and aria-controls (for example aria-controls="privacy_overview"). The elements those buttons control have no role and no accessible name. Those elements are the <div class="moove-gdpr-tab-main"> in gdpr-modules/modal/content-sections/*.php.

    The validator says: “Every active role=tab element must have a corresponding role=tabpanel element.” Screen readers announce the tabs, but they don’t announce the content as the tab’s panel. The rest of the tab pattern already works well (role="tablist", aria-selected, arrow keys).

    Suggested fix: in each content section, add the role and point to the tab button. For example, in overview.php:

    <div id="privacy_overview" class="moove-gdpr-tab-main" role="tabpanel" aria-labelledby="gdpr-tab-privacy_overview">
    

    Do the same for strictly.php (gdpr-tab-strict-necessary-cookies), third_party.php, advanced.php, cookiepolicy.php and the other category sections.

    2. The font family is escaped with esc_attr() inside a <style> element

    In gdpr-modules/branding-styles.php, get_minified_styles() receives esc_attr( $font_family ). The default value is 'Nunito', sans-serif, so the quotes come out as &#039;Nunito&#039;. Browsers don’t decode entities inside <style>, so the CSS declaration is invalid. The validator reports “CSS: font-family: Parse Error”, and the browser ignores the rule.

    Suggested fix: use a sanitizer that suits CSS instead of esc_attr(). For example, keep only the characters a font list needs:

    preg_replace( '/[^a-zA-Z0-9 ,\'"\-]/', '', $font_family )
    

    That still blocks anything that could close the <style> element.

    In the meantime we’ve worked around the first issue with the gdpr_modal_base_module filter. Thanks for providing it. A fix in the plugin itself would help every site that uses it.

    Thank you for the plugin!

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Support Jane

    (@janeaustin)

    Hi @csmestar

    Thanks for the detailed report and for including the validator output, it made both issues quick to track down.

    Both are now fixed. In the tabs layout, each section of the cookie settings screen is now marked up as a tab panel (role=”tabpanel”, labelled by its tab), including the Performance and Preference categories from the premium add-on. The font family is no longer HTML-escaped inside the style block, so ‘Nunito’, sans-serif and other quoted font names now reach the browser as valid CSS. The value is still filtered so it can’t break out of the stylesheet.

    After updating, you can remove your gdpr_modal_base_module filter. Please run the page through the validator again and let us know if anything is still flagged.

    Hope this helps.

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.