fix(marketing): A-2.7b WCAG 2.2 AA polish + JSON-LD test hardening

- Drop role="region" from FAQ panels (had no accessible name — axe-core
  violation; disclosure pattern with button + aria-controls + aria-expanded
  is sufficient per WAI-APG accordion guidance)
- Add focus-visible:outline-2 outline-brand-b1 outline-offset-2 to FAQ
  buttons (WCAG 2.2 AA 2.4.7 Focus Not Obscured + 2.4.11 Focus Appearance —
  Safari default focus indicator is unreliable)
- Sweep pre-existing text-white/50 on Hero social proof microcopy → /70
  (branch-wide WCAG floor; recurring landmine flagged at A-2.7a review)
- Strengthen test_faq_jsonld_schema_present to json.loads() the extracted
  block and validate the FAQPage schema shape (regression guard for future
  content edits with unescaped backslashes/quotes)
This commit is contained in:
Allison
2026-04-27 20:34:53 -04:00
parent 824ea638de
commit 2b3eeb98e0
3 changed files with 36 additions and 4 deletions

View File

@@ -696,6 +696,23 @@ def test_faq_jsonld_schema_present():
assert '&nbsp;' not in body[body.find('"FAQPage"'):body.find('</script>', body.find('"FAQPage"'))], \
"JSON-LD must not contain raw '&nbsp;' entities — strip them server-side"
# M-1 hardening: actually parse the JSON-LD to catch malformed JSON regressions
import json
import re
match = re.search(r'<script type="application/ld\+json">(.*?)</script>',
body, re.DOTALL)
assert match, "JSON-LD block not found"
parsed = json.loads(match.group(1))
assert parsed['@context'] == 'https://schema.org'
assert parsed['@type'] == 'FAQPage'
assert isinstance(parsed['mainEntity'], list)
assert len(parsed['mainEntity']) == 7, "FAQPage must contain exactly 7 questions"
for q in parsed['mainEntity']:
assert q['@type'] == 'Question'
assert q['acceptedAnswer']['@type'] == 'Answer'
assert q['name'].strip(), "Question name must not be empty"
assert q['acceptedAnswer']['text'].strip(), "Answer text must not be empty"
def test_cta_final_section():
"""CTA final section with mailto pré-inscription + ghost button to #tarifs."""