Accessibility: tab panels lack role=tabpanel; font-family escaped in style
-
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 hasrole="tab"andaria-controls(for examplearia-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">ingdpr-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.phpand the other category sections.2. The font family is escaped with
esc_attr()inside a<style>elementIn
gdpr-modules/branding-styles.php,get_minified_styles()receivesesc_attr( $font_family ). The default value is'Nunito', sans-serif, so the quotes come out as'Nunito'. 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_modulefilter. 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]
You must be logged in to reply to this topic.