Skip to content

Commit bc89f6b

Browse files
committed
FCL-631 | add front-end ADRS
1 parent 4c88564 commit bc89f6b

24 files changed

+1082
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# 22. TNA Front-End Colour Overrides
2+
3+
**Date:** 2025-02-07
4+
**Status:** Accepted
5+
6+
## Context
7+
8+
### Background
9+
10+
The application uses colour values provided by the TNA front-end library. However, the available colours do not fully align with the requirements of Find Case Law.
11+
12+
### Problem
13+
14+
The existing TNA colour palette does not provide appropriate mappings for all features and areas within Find Case Law, resulting in inconsistent or suboptimal visual presentation.
15+
16+
### Goals
17+
18+
Establish a mechanism to define colours that align with the requirements of Find Case Law while maintaining compatibility with the TNA front-end library.
19+
20+
## Options Considered
21+
22+
1. Use an alternative colour scheme instead of the TNA colours.
23+
2. Introduce additional colours outside the TNA scheme and combine them as needed.
24+
3. Override specific TNA colours to better align with the Find Case Law design.
25+
26+
## Decision
27+
28+
### Solution
29+
30+
Override specific TNA colour values by importing the SCSS variable map into the application and redefining the relevant colours.
31+
32+
### Justification
33+
34+
- Maintains alignment with the colour choices defined in the colour variable ADR.
35+
- Provides flexibility to adjust colour values as needed for Find Case Law.
36+
- Reduces the need for a completely independent colour scheme.
37+
38+
## Consequences
39+
40+
- The application will diverge from the standard TNA colour scheme.
41+
- Changes to the TNA colour variable map (e.g., naming conventions or format) will require updates to the implementation.
42+
- The modified colours may not fully adhere to the accessibility standards of the TNA scheme.

doc/adr/0023-style-lint.md

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# 23. StyleLint Configuration
2+
3+
**Date:** 2025-02-07
4+
**Status:** Accepted
5+
6+
## Context
7+
8+
### Background
9+
10+
A basic configuration of StyleLint is currently enforced through a pre-commit hook. However, this configuration is minimal.
11+
12+
### Problem
13+
14+
The existing StyleLint setup lacks comprehensive rules to ensure consistent and standardised CSS. This results in potential inconsistencies that require manual intervention during development and code reviews.
15+
16+
### Goals
17+
18+
Implement an automated style linting configuration that enforces consistent and standardised CSS while minimising manual effort during composition and review.
19+
20+
## Options Considered
21+
22+
1. Use the `stylelint-selector-bem` library to enforce BEM class naming.
23+
2. Use the `stylelint-clean-order` library to enforce a structured CSS property order.
24+
3. Use `stylelint-standard-css` to enforce general CSS best practices.
25+
4. Define a custom selector class pattern for BEM class naming.
26+
5. Maintain a per-repository StyleLint configuration file.
27+
6. Use a shared StyleLint configuration file across repositories, with the option for per-repository extensions.
28+
29+
## Decision
30+
31+
### Solution
32+
33+
- Use the `stylelint-clean-order` and `stylelint-standard-css` libraries for property ordering and general CSS best practices.
34+
- Define a custom selector class pattern for BEM class naming.
35+
- Maintain a shared StyleLint configuration file that can be extended by individual repositories as needed.
36+
37+
### Justification
38+
39+
- The `stylelint-clean-order` and `stylelint-standard-css` libraries provide effective linting out of the box, reducing the need to define custom rules.
40+
- The `stylelint-selector-bem` library requires extensive configuration, making it equivalent to defining custom rules manually.
41+
- A shared StyleLint configuration ensures consistency across repositories while allowing flexibility where necessary.
42+
43+
## Consequences
44+
45+
- The BEM selector function must be maintained internally. However, as the BEM methodology is stable, changes should be infrequent.
46+
- Allowing repositories to extend the shared configuration introduces the possibility of slight deviations in CSS conventions across projects.
47+
- Any updates to the StyleLint configuration will require corresponding updates in downstream repositories, including adjustments to any affected CSS.
+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# 24. Usage of GOV.UK Front-End
2+
3+
**Date:** 2025-02-07
4+
**Status:** Accepted
5+
6+
## Context
7+
8+
### Background
9+
10+
The Find Case Law website is a public government service. The GOV.UK Frontend library provides pre-built, accessible components designed for government services.
11+
12+
### Problem
13+
14+
To develop new features efficiently, the project requires a component library that is accessible, follows industry standards, and minimises maintenance effort. Building all components from scratch would slow development and increase maintenance overhead.
15+
16+
### Goals
17+
18+
- Ensure accessibility in new features.
19+
- Accelerate development.
20+
- Maintain industry-standard component behavior.
21+
- Minimise code maintenance.
22+
23+
## Options Considered
24+
25+
1. Build a custom component library from scratch.
26+
2. Use the GOV.UK Frontend library as a dependency and override styling where necessary.
27+
3. Fork the GOV.UK component library and modify core styles directly.
28+
4. Use a third-party component library and style it to match Find Case Law branding.
29+
30+
## Decision
31+
32+
### Solution
33+
34+
- Add the GOV.UK Frontend library as a dependency.
35+
- Override styles that do not align with Find Case Law where necessary.
36+
- Keep CSS overrides as decoupled from the application as possible.
37+
- Wrap GOV.UK components in Find Case Law-specific components to decouple usage from direct dependency on GOV.UK markup.
38+
39+
### Justification
40+
41+
- Using GOV.UK Frontend as a dependency ensures compatibility with upstream updates and feature additions.
42+
- Overriding styles selectively minimises breaking changes and prevents tight coupling between Find Case Law styling and GOV.UK components.
43+
- Abstracting GOV.UK components into Find Case Law equivalents allows for future changes with minimal impact when updating the library.
44+
45+
## Consequences
46+
47+
- New features can be built efficiently without unnecessary development overhead.
48+
- Components remain accessible and adhere to government service standards.
49+
- Decoupling from direct GOV.UK component usage reduces maintenance effort and limits the impact of upstream changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# 25. Usage of Home Office Front-End
2+
3+
**Date:** 2025-02-07
4+
**Status:** Accepted
5+
6+
## Context
7+
8+
### Background
9+
10+
The application currently uses multiple alert components from different libraries, leading to inconsistencies in styling and behavior.
11+
12+
### Problem
13+
14+
The use of multiple alert component styles results in an inconsistent user experience and increases maintenance overhead by requiring support for multiple implementations.
15+
16+
### Goals
17+
18+
- Standardise the alert component across the application.
19+
- Minimise maintenance effort.
20+
- Ensure accessibility.
21+
- Align the alert component's styling with the Find Case Law service.
22+
23+
## Options Considered
24+
25+
1. Build a custom alert component.
26+
2. Use the GOV.UK Frontend alert component.
27+
3. Use the TNA Frontend alert component.
28+
4. Use the Home Office alert component.
29+
30+
## Decision
31+
32+
### Solution
33+
34+
- Use the Home Office alert component.
35+
- Extract and integrate only this component rather than including the entire Home Office Frontend library.
36+
37+
### Justification
38+
39+
- The Home Office alert component aligns most closely with the Find Case Law styling, requiring minimal modifications.
40+
- Using a pre-existing, accessible component reduces development and maintenance effort compared to a custom implementation.
41+
- Extracting only the required component avoids unnecessary dependencies from the full Home Office Frontend library.
42+
43+
## Consequences
44+
45+
- The application will have a consistent and accessible alert component.
46+
- The extracted component will need to be manually maintained as an external dependency.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# 26. Playwright for End-to-End Testing
2+
3+
**Date:** 2025-02-07
4+
**Status:** Accepted
5+
6+
## Context
7+
8+
### Background
9+
10+
End-to-end (E2E) tests are required to ensure the Find Case Law website functions as expected while implementing changes and new features.
11+
12+
### Problem
13+
14+
Currently, end-to-end testing is performed manually, which is time-consuming, prone to being overlooked, and increases the risk of regressions in less frequently used areas of the website.
15+
16+
### Goals
17+
18+
- Implement automated end-to-end tests for critical user paths.
19+
- Integrate tests into the CI/CD pipeline for automated execution.
20+
- Use a well-maintained and widely adopted testing framework.
21+
- Ensure tests are written in a language all developers are comfortable with.
22+
23+
## Options Considered
24+
25+
1. **Cypress** – Popular and feature-rich but requires JavaScript/TypeScript.
26+
2. **Playwright** – Supports multiple languages, including Python, and is well-maintained.
27+
3. **Capybara** – Primarily used in Ruby environments, not suitable for this project.
28+
4. **Puppeteer** – JavaScript-based and less feature-complete for end-to-end testing compared to Playwright.
29+
30+
## Decision
31+
32+
### Solution
33+
34+
Use **Playwright** for end-to-end testing.
35+
36+
### Justification
37+
38+
- Playwright supports Python, ensuring all developers can contribute to test writing and maintenance.
39+
- It is a well-maintained, widely adopted, and feature-rich testing framework.
40+
- Playwright provides robust support for modern web applications, including handling multiple browser contexts, network mocking, and parallel execution.
41+
42+
## Consequences
43+
44+
- End-to-end tests must be written and maintained for all critical user paths.
45+
- Automated testing will increase confidence in the stability of the service during development and deployment.
46+
- Updates to key user paths will require corresponding updates to the end-to-end tests.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# 27. Automated Accessibility Checking
2+
3+
**Date:** 2025-02-07
4+
**Status:** Accepted
5+
6+
## Context
7+
8+
### Background
9+
10+
Automating accessibility testing is necessary to ensure that the Find Case Law service meets accessibility standards consistently.
11+
12+
### Problem
13+
14+
Accessibility testing is currently a manual process with no standardised approach. As a result, accessibility best practices are often overlooked during development, leading to inconsistent compliance and potential usability issues.
15+
16+
### Goals
17+
18+
- Implement an automated process to flag accessibility issues in the codebase.
19+
- Standardise accessibility tests to ensure consistency and alignment with formal accessibility audits.
20+
21+
## Options Considered
22+
23+
1. **BrowserStack** – Provides accessibility testing as a service but adds external dependencies and potential cost overhead.
24+
2. **PA11Y** – An open-source tool, but requires additional configuration and does not integrate with Playwright.
25+
3. **Axe-Core** – A widely used accessibility engine, but would require additional scripting for automation.
26+
4. **Wave Chrome Extension with a test script** – Useful for manual checks but does not support automated testing.
27+
5. **Axe-Playwright** – A wrapper around Axe-Core that integrates directly with Playwright for automated accessibility testing.
28+
29+
## Decision
30+
31+
### Solution
32+
33+
Integrate **Axe-Playwright** into the existing automated test suite to perform accessibility checks on all pages covered by end-to-end tests.
34+
35+
### Justification
36+
37+
- Seamlessly integrates with the existing Playwright-based testing setup.
38+
- Provides standardised accessibility checks aligned with industry best practices.
39+
- Works within the CI/CD pipeline, enabling continuous accessibility monitoring.
40+
41+
## Consequences
42+
43+
- All pages covered by end-to-end tests will undergo automated accessibility checks, ensuring key user journeys remain accessible.
44+
- Any new pages requiring accessibility validation must have corresponding Playwright tests.
45+
- Large feature implementations that introduce accessibility issues will need to be fixed before merging and releasing code.

doc/adr/0028-sass-for-all-css.md

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# 28. Using SASS for All CSS
2+
3+
**Date:** 2025-02-07
4+
**Status:** Accepted
5+
6+
## Context
7+
8+
### Background
9+
10+
The Find Case Law front-end requires a maintainable and efficient styling approach.
11+
12+
### Problem
13+
14+
Writing styles in pure CSS is inefficient, difficult to maintain, and increases the risk of inconsistencies across the application.
15+
16+
### Goals
17+
18+
- Implement a simple and efficient approach to writing CSS.
19+
- Reduce duplication and promote reusability of styles.
20+
- Ensure compiled CSS is optimised for performance.
21+
22+
## Options Considered
23+
24+
1. **Pure CSS** – Lacks support for variables, mixins, and other features that improve maintainability.
25+
2. **LESS** – Similar to SCSS but less commonly used and supported in government services.
26+
3. **SCSS** – Widely used, flexible, and compatible with GOV.UK Frontend and other government-supported libraries.
27+
4. **Stylus** – Less commonly adopted and has a smaller ecosystem.
28+
5. **PostCSS** – Powerful but primarily used for processing CSS rather than writing styles directly.
29+
30+
## Decision
31+
32+
### Solution
33+
34+
Adopt SCSS as the standard for all front-end styling in Find Case Law.
35+
36+
### Justification
37+
38+
- SCSS is widely used in public sector applications, including GOV.UK services.
39+
- Seamlessly integrates with government-supported libraries such as GOV.UK Frontend.
40+
- Enables writing efficient and maintainable CSS using variables, mixins, and nesting.
41+
- Supports compiling optimised CSS with reduced duplication.
42+
43+
## Consequences
44+
45+
- SCSS-supported libraries can be integrated more easily.
46+
- GOV.UK Frontend styles can be imported and customised as needed.
47+
- Styles will be more maintainable, efficient, and consistent across the application.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# 29. CSS Spacing Variable Convention
2+
3+
**Date:** 2025-02-07
4+
**Status:** Accepted
5+
6+
## Context
7+
8+
### Background
9+
10+
Spacing values across the application are currently inconsistent and do not follow a standardised convention.
11+
12+
### Problem
13+
14+
The lack of a consistent spacing convention results in:
15+
16+
- Inconsistencies in user experience and visual design.
17+
- Increased maintenance overhead when adjusting spacing.
18+
- Difficulty in making layout changes efficiently.
19+
20+
### Goals
21+
22+
- Standardise spacing values across the Find Case Law front-end.
23+
- Reduce maintenance effort when updating spacing.
24+
- Provide a clear convention to enable faster development and modifications.
25+
26+
## Options Considered
27+
28+
1. **Use SCSS functions** – Generate spacing values dynamically based on a base size (e.g., `calc(base-size * 1.5)`).
29+
2. **Use named size variables** – Define a static set of variables (`xs`, `sm`, `lg`, `xl`) based on relative size.
30+
3. **Use numerical naming convention** – Define a static set of variables using a numbered scale (`space-1`, `space-2`, etc.).
31+
4. **Use variables that mimic values** – Define variables where the name directly reflects the value (e.g., `space-1` equals `1rem`).
32+
33+
## Decision
34+
35+
### Solution
36+
37+
Adopt a static set of variables following a numerical naming convention (e.g., `space-1`, `space-2`, etc.).
38+
39+
### Justification
40+
41+
- SCSS functions add unnecessary cognitive complexity, as the output is not immediately clear when reading the SCSS.
42+
- Named size variables (e.g., `xs`, `sm`, `lg`) lack clear relationships between values, making it harder to determine spacing hierarchy.
43+
- Variables that mimic their values directly (e.g., `space-1 = 1rem`) create unnecessary maintenance overhead, as renaming would be required if values change.
44+
- A numerical naming convention provides:
45+
- **Consistency** – Ensures predictable spacing across the application.
46+
- **Maintainability** – Values can be adjusted without renaming variables.
47+
- **Clarity** – Developers can easily compare spacing values in relation to each other.
48+
49+
## Consequences
50+
51+
- **Consistent user experience** – Spacing will be uniform across the website.
52+
- **Simplified development** – A clear convention reduces ambiguity and speeds up implementation.
53+
- **Easier maintenance** – Updating spacing values will not require renaming variables.

0 commit comments

Comments
 (0)