Skip to content

Conversation

@NatashaAlker
Copy link

@NatashaAlker NatashaAlker commented Nov 28, 2025

Jira link

https://tools.hmcts.net/jira/browse/VIBE-236

Change description

  • Updated accessibility statement content in both English and Welsh
  • Updated accessibility statement page layout
  • Added test coverage for the updated template

Testing done

Security Vulnerability Assessment

CVE Suppression: Are there any CVEs present in the codebase (either newly introduced or pre-existing) that are being intentionally suppressed or ignored by this commit?

  • Yes
  • No

Checklist

  • commit messages are meaningful and follow good commit message guidelines
  • README and other documentation has been updated / added (if needed)
  • tests have been updated / new tests has been added (if needed)
  • Does this PR introduce a breaking change

Summary by CodeRabbit

  • New Features

    • Added structured feedback and reporting sections with contact details and alternative communication options (text relay, audio loops).
    • Introduced a visible "Back to top" link/label for both English and Welsh locales.
  • Improvements

    • Updated accessibility statement layout and typography for clearer hierarchy and readability.
    • Accessibility statement footer link now opens in a new tab with security attributes.
  • Tests

    • Updated unit and end-to-end tests to verify new texts, contact fields, back-to-top presence, and footer link behavior.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Nov 28, 2025

Walkthrough

Back-to-top selection changed to find an anchor inside a container. Accessibility statement data (EN/CY) expanded with many structured fields (contacts, links, assistive options). Template and tests updated to render and assert new fields. Footer accessibility link now opens in a new tab with security attributes.

Changes

Cohort / File(s) Summary
Back-to-top component
libs/web-core/src/assets/js/back-to-top.ts, libs/web-core/src/assets/js/back-to-top.test.ts
Selector refactor: container .back-to-top-link is queried first, then its child a is looked up; tests updated to match the new paragraph-wrapping DOM structure.
Accessibility statement data (English & Welsh)
libs/web-core/src/pages/accessibility-statement/en.ts, libs/web-core/src/pages/accessibility-statement/cy.ts
Large structural expansion: added backToTop, service metadata (serviceUrl, serviceUrlFull, serviceDescription), commitment/feature fields, expanded feedback and reporting contacts (name, phone, hours, email), textRelay, audioLoops, formatRequest, and link metadata for enforcement/compliance (eass/wcag fields). testing changed to an array; various headings/keys renamed.
Accessibility statement template
libs/web-core/src/pages/accessibility-statement/index.njk
Template adjusted for new fields: heading level changes, service link and description rendering, reworked How accessible/feedback/reporting/enforcement/compliance sections, testing/preparation rendering updates, and added back-to-top link block with SVG.
Accessibility statement tests
libs/web-core/src/pages/accessibility-statement/index.njk.test.ts, libs/web-core/src/pages/accessibility-statement/index.test.ts
Tests augmented to assert backToTop text and new feedback fields (contact.name, textRelay, audioLoops) for both locales.
Site footer
libs/web-core/src/views/components/site-footer.njk
Accessibility statement footer link updated to include target="_blank" and rel="noopener noreferrer".
E2E footer checks
e2e-tests/tests/page-structure.spec.ts
Footer link assertions reorganized: count verified, same-tab links iterated separately, and accessibility-statement link validated specifically for _blank + noopener noreferrer.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Review mapping between newly added data fields in en.ts/cy.ts and their usages in index.njk.
  • Verify optional chaining and event attachment behavior in back-to-top.ts.
  • Confirm tests and e2e adjustments match the rendered DOM and link attributes.

Suggested reviewers

  • KianKwa
  • ChrisS1512

Poem

🐇 I hopped through markup, careful and spry,

Found anchors nested where paragraphs lie.
I policed the footer, set links to take flight,
And filled statements with details to read day or night.
A tiny rabbit cheer for accessibility's light 🌟

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: updating accessibility statement content. It directly relates to the substantial modifications across English and Welsh accessibility statement files.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch VIBE-236

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
libs/web-core/src/pages/accessibility-statement/en.ts (1)

19-23: Minor inconsistency: abilityNetPrefix missing in English but present in Welsh.

The English locale is missing abilityNetPrefix which exists in cy.ts (Line 20: abilityNetPrefix: "Mae gan "). The template at Line 18 conditionally renders this prefix only if it exists, so this works, but the structural inconsistency may cause confusion.

Consider adding an empty string or the appropriate English prefix for structural parity:

       simpleLanguage: "We've also made the website text as simple as possible to understand.",
+      abilityNetPrefix: "",
       abilityNetLink: "AbilityNet (opens in a new window)",
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9408752 and e4ba0e6.

📒 Files selected for processing (8)
  • libs/web-core/src/assets/js/back-to-top.test.ts (7 hunks)
  • libs/web-core/src/assets/js/back-to-top.ts (1 hunks)
  • libs/web-core/src/pages/accessibility-statement/cy.ts (1 hunks)
  • libs/web-core/src/pages/accessibility-statement/en.ts (1 hunks)
  • libs/web-core/src/pages/accessibility-statement/index.njk (2 hunks)
  • libs/web-core/src/pages/accessibility-statement/index.njk.test.ts (4 hunks)
  • libs/web-core/src/pages/accessibility-statement/index.test.ts (1 hunks)
  • libs/web-core/src/views/components/site-footer.njk (1 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: TypeScript variables must use camelCase (e.g., userId, caseDetails, documentId). Booleans should use is/has/can prefix (e.g., isActive, hasAccess, canEdit).
Classes and Interfaces must use PascalCase (e.g., UserService, CaseRepository). Do NOT use I prefix for interfaces (use UserRepository not IUserRepository).
Constants must use SCREAMING_SNAKE_CASE (e.g., MAX_FILE_SIZE, DEFAULT_TIMEOUT).
Module ordering: consts outside function scope at top, exported functions next, other functions ordered by usage, interfaces and types at bottom.
TypeScript must use strict mode enabled with no any without justification. Use workspace aliases (@hmcts/*) for imports.
Always add .js extension to relative imports (e.g., import { foo } from "./bar.js"). This is required for ESM with Node.js "nodenext" module resolution, even when importing TypeScript files.
All input endpoints must validate inputs. Use parameterized database queries with Prisma. Never include sensitive data in logs.
Only export functions that are intended to be used outside the module. Don't export functions solely for testing purposes.
Only add comments when they are meaningful. Explain why something is done, not what is done.
Favor functional style with simple functional approaches. Don't use a class unless you have shared state.
Data should be immutable by default. Use const and avoid mutations to ensure predictable state.
Functions should have no side effects. Avoid modifying external state or relying on mutable data.
Use Express version 5.x with proper async/await error handling in middleware and route handlers.

Files:

  • libs/web-core/src/pages/accessibility-statement/index.njk.test.ts
  • libs/web-core/src/assets/js/back-to-top.test.ts
  • libs/web-core/src/pages/accessibility-statement/index.test.ts
  • libs/web-core/src/assets/js/back-to-top.ts
  • libs/web-core/src/pages/accessibility-statement/en.ts
  • libs/web-core/src/pages/accessibility-statement/cy.ts
**/*.ts

📄 CodeRabbit inference engine (CLAUDE.md)

API endpoints must use plural for collections (/api/cases, /api/users), singular for specific resources (/api/case/:id), and singular for creation (POST /api/case).

Files:

  • libs/web-core/src/pages/accessibility-statement/index.njk.test.ts
  • libs/web-core/src/assets/js/back-to-top.test.ts
  • libs/web-core/src/pages/accessibility-statement/index.test.ts
  • libs/web-core/src/assets/js/back-to-top.ts
  • libs/web-core/src/pages/accessibility-statement/en.ts
  • libs/web-core/src/pages/accessibility-statement/cy.ts
**/{pages,locales}/**/*.{ts,njk}

📄 CodeRabbit inference engine (CLAUDE.md)

Every page must support both English and Welsh by providing en and cy objects in controllers and maintaining matching structure in locale files (libs/[module]/src/locales/en.ts and cy.ts).

Files:

  • libs/web-core/src/pages/accessibility-statement/index.njk.test.ts
  • libs/web-core/src/pages/accessibility-statement/index.test.ts
  • libs/web-core/src/pages/accessibility-statement/index.njk
  • libs/web-core/src/pages/accessibility-statement/en.ts
  • libs/web-core/src/pages/accessibility-statement/cy.ts
**/*.test.ts

📄 CodeRabbit inference engine (CLAUDE.md)

All packages must use "test": "vitest run" as the test script. Unit and integration tests must be co-located with source code as *.test.ts files.

Files:

  • libs/web-core/src/pages/accessibility-statement/index.njk.test.ts
  • libs/web-core/src/assets/js/back-to-top.test.ts
  • libs/web-core/src/pages/accessibility-statement/index.test.ts
**/pages/**/*.ts

📄 CodeRabbit inference engine (CLAUDE.md)

Page routes are created based on file names within the pages/ directory. Nested routes are created using subdirectories (e.g., pages/admin/my-page.ts becomes /admin/my-page).

Files:

  • libs/web-core/src/pages/accessibility-statement/index.njk.test.ts
  • libs/web-core/src/pages/accessibility-statement/index.test.ts
  • libs/web-core/src/pages/accessibility-statement/en.ts
  • libs/web-core/src/pages/accessibility-statement/cy.ts
**/{locales,pages}/**/*.ts

📄 CodeRabbit inference engine (CLAUDE.md)

Shared/common content (button text, phase banner, service name, common errors) should be in locale files (libs/[module]/src/locales/en.ts and cy.ts). Page-specific content should be in controllers.

Files:

  • libs/web-core/src/pages/accessibility-statement/index.njk.test.ts
  • libs/web-core/src/pages/accessibility-statement/index.test.ts
  • libs/web-core/src/pages/accessibility-statement/en.ts
  • libs/web-core/src/pages/accessibility-statement/cy.ts
🧠 Learnings (4)
📚 Learning: 2025-11-25T06:40:24.099Z
Learnt from: CR
Repo: hmcts/cath-service PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T06:40:24.099Z
Learning: Applies to **/{pages,locales}/**/*.{ts,njk} : Every page must support both English and Welsh by providing `en` and `cy` objects in controllers and maintaining matching structure in locale files (libs/[module]/src/locales/en.ts and cy.ts).

Applied to files:

  • libs/web-core/src/pages/accessibility-statement/index.njk.test.ts
  • libs/web-core/src/pages/accessibility-statement/index.test.ts
📚 Learning: 2025-11-25T06:40:24.099Z
Learnt from: CR
Repo: hmcts/cath-service PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T06:40:24.099Z
Learning: Applies to **/{locales,pages}/**/*.ts : Shared/common content (button text, phase banner, service name, common errors) should be in locale files (libs/[module]/src/locales/en.ts and cy.ts). Page-specific content should be in controllers.

Applied to files:

  • libs/web-core/src/pages/accessibility-statement/index.njk.test.ts
📚 Learning: 2025-11-25T06:40:24.099Z
Learnt from: CR
Repo: hmcts/cath-service PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T06:40:24.099Z
Learning: Applies to **/pages/*.ts : Page controllers must export GET and/or POST functions with signature `(req: Request, res: Response) => Promise<void>`. Content (titles, descriptions) should be organized as `en` and `cy` objects.

Applied to files:

  • libs/web-core/src/pages/accessibility-statement/index.test.ts
📚 Learning: 2025-11-25T06:40:24.099Z
Learnt from: CR
Repo: hmcts/cath-service PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T06:40:24.099Z
Learning: Applies to **/pages/*.njk : Nunjucks templates must extend `layouts/default.njk` and use GOV.UK Design System macros. Every page must support both English and Welsh content.

Applied to files:

  • libs/web-core/src/pages/accessibility-statement/index.njk
🧬 Code graph analysis (2)
libs/web-core/src/pages/accessibility-statement/index.njk.test.ts (2)
libs/web-core/src/pages/accessibility-statement/en.ts (1)
  • en (1-104)
libs/web-core/src/pages/accessibility-statement/cy.ts (1)
  • cy (1-105)
libs/web-core/src/assets/js/back-to-top.test.ts (1)
libs/web-core/src/assets/js/back-to-top.ts (1)
  • initBackToTop (1-14)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: SonarQube Analysis
  • GitHub Check: E2E Tests
🔇 Additional comments (19)
libs/web-core/src/assets/js/back-to-top.test.ts (6)

19-36: LGTM!

The test correctly reflects the new DOM structure where the anchor is nested inside a paragraph container. The dynamic import pattern ensures proper module isolation.


38-59: LGTM!

Good coverage of the preventDefault behavior with the updated selector.


61-75: LGTM!

Edge case coverage for missing elements is maintained.


77-96: LGTM!

Good test for nested content within the anchor element.


98-122: LGTM!

Important edge case: verifies that only the first back-to-top link receives the handler when multiple exist. This matches the querySelector behavior in the implementation.


124-141: LGTM!

Remaining tests properly verify scroll behavior details with the updated DOM structure.

Also applies to: 143-161, 163-181

libs/web-core/src/pages/accessibility-statement/index.test.ts (1)

16-33: LGTM!

The test correctly validates both English and Welsh locale objects include the new backToTop field alongside the existing title. This ensures bilingual consistency as required by the coding guidelines.

libs/web-core/src/views/components/site-footer.njk (1)

19-26: Verify: Opening internal link in new tab is intentional?

The /accessibility-statement is an internal route, but it's configured to open in a new tab (target="_blank"). Other footer links (including external gov.uk links) don't use this pattern.

If this is intentional (e.g., to preserve user context during a flow), the security attributes are correctly applied. However, opening internal pages in new tabs can be unexpected for users and may cause accessibility/usability concerns (users may not realize they've opened a new tab).

Please confirm this behavior is intentional per HMCTS UX guidelines.

libs/web-core/src/pages/accessibility-statement/index.njk.test.ts (4)

24-26: LGTM!

Good addition of test coverage for the new backToTop field in English locale.


35-41: LGTM!

Test coverage appropriately extended to verify the new feedback section fields including contact.name, textRelay, and audioLoops.


54-56: LGTM!

Welsh locale test for backToTop ensures bilingual parity.


65-71: LGTM!

Welsh locale test mirrors the English feedback field tests, maintaining structural consistency.

libs/web-core/src/assets/js/back-to-top.ts (1)

1-14: LGTM!

Clean implementation with two-step lookup pattern. Optional chaining (backToTopContainer?.querySelector("a")) safely handles the case where the container doesn't exist. The approach is more flexible and accommodates the new DOM structure.

libs/web-core/src/pages/accessibility-statement/en.ts (1)

1-104: LGTM - Well-structured accessibility statement content.

The expanded data structure with separate URL and display text fields (serviceUrl/serviceUrlFull, wcagUrl/wcagLinkText, etc.) is a good pattern for maintainability. The content properly supports the template's rendering requirements.

libs/web-core/src/pages/accessibility-statement/index.njk (4)

4-7: LGTM!

Good use of the new structured intro fields with proper link rendering.


17-19: Good conditional handling for language differences.

The conditional check for abilityNetPrefix gracefully handles the structural difference between English and Welsh locales.


80-87: LGTM - Back-to-top component properly implemented.

The structure matches the expected DOM structure in back-to-top.ts and tests. The SVG icon is appropriately marked with focusable="false" to prevent keyboard focus on the decorative element.


21-42: I'll help you verify the accessibility concern about heading hierarchy. Let me start by exploring the file structure and understanding the context.
<function_calls>


#!/bin/bash

First, let's find the accessibility-statement directory and explore its structure

find . -type d -name "accessibility-statement" | head -20


</function_calls>
<function_calls>


#!/bin/bash

Let's read the complete template file to see the full heading hierarchy

cat -n libs/web-core/src/pages/accessibility-statement/index.njk


</function_calls>
<function_calls>


#!/bin/bash

Let's find the controller and locale files for accessibility-statement

find libs/web-core/src -type f -name "accessibility" | grep -E ".(ts|js|njk)$"


</function_calls>

libs/web-core/src/pages/accessibility-statement/cy.ts (1)

1-105: LGTM - Welsh locale properly structured.

The Welsh content mirrors the English structure, maintaining bilingual consistency as required by the coding guidelines. The additional abilityNetPrefix field ("Mae gan ") is appropriately included to handle Welsh sentence structure differences.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 28, 2025

🎭 Playwright E2E Test Results

419 tests   419 ✅  32m 44s ⏱️
 22 suites    0 💤
  1 files      0 ❌

Results for commit 17ac774.

♻️ This comment has been updated with latest results.

@sonarqubecloud
Copy link

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
e2e-tests/tests/page-structure.spec.ts (1)

77-104: Tidy up footer link test naming and make full use of test data

The logic for counting 8 footer links and splitting same‑tab vs new‑tab behavior looks sound, but there are a couple of small cleanups you could make:

  • sameTablLinks has a spelling typo and is a bit hard to read; consider renaming to sameTabLinks for clarity and consistency with camelCase naming, as per coding guidelines.
  • Each object in sameTablLinks carries a text field that is currently unused. If you want the test to guard against content regressions as well as URLs, you could also assert the link text (e.g. await expect(footerLink).toHaveText(link.text)), or drop the text property to avoid confusion.

These are minor, but they make the test intent and data shape clearer.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e4ba0e6 and 17ac774.

📒 Files selected for processing (1)
  • e2e-tests/tests/page-structure.spec.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: TypeScript variables must use camelCase (e.g., userId, caseDetails, documentId). Booleans should use is/has/can prefix (e.g., isActive, hasAccess, canEdit).
Classes and Interfaces must use PascalCase (e.g., UserService, CaseRepository). Do NOT use I prefix for interfaces (use UserRepository not IUserRepository).
Constants must use SCREAMING_SNAKE_CASE (e.g., MAX_FILE_SIZE, DEFAULT_TIMEOUT).
Module ordering: consts outside function scope at top, exported functions next, other functions ordered by usage, interfaces and types at bottom.
TypeScript must use strict mode enabled with no any without justification. Use workspace aliases (@hmcts/*) for imports.
Always add .js extension to relative imports (e.g., import { foo } from "./bar.js"). This is required for ESM with Node.js "nodenext" module resolution, even when importing TypeScript files.
All input endpoints must validate inputs. Use parameterized database queries with Prisma. Never include sensitive data in logs.
Only export functions that are intended to be used outside the module. Don't export functions solely for testing purposes.
Only add comments when they are meaningful. Explain why something is done, not what is done.
Favor functional style with simple functional approaches. Don't use a class unless you have shared state.
Data should be immutable by default. Use const and avoid mutations to ensure predictable state.
Functions should have no side effects. Avoid modifying external state or relying on mutable data.
Use Express version 5.x with proper async/await error handling in middleware and route handlers.

Files:

  • e2e-tests/tests/page-structure.spec.ts
**/*.ts

📄 CodeRabbit inference engine (CLAUDE.md)

API endpoints must use plural for collections (/api/cases, /api/users), singular for specific resources (/api/case/:id), and singular for creation (POST /api/case).

Files:

  • e2e-tests/tests/page-structure.spec.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: SonarQube Analysis
  • GitHub Check: E2E Tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants