Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 1 addition & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,6 @@ http://it2810-03.idi.ntnu.no/project2/
- **Profile:** Your preferences and saved plants in one place.
- **Language and theme:** The app is available in English and Norwegian, and has a light and a dark theme.

## Accessibility

The app includes the following accessibility features:

- **Page structure:** Semantic `header`, `nav`, `main` and `article` elements organise the content. Sidebar navigation has an accessible name, and the current page is marked with `aria-current="page"`.
- **Keyboard controls:** Navigation uses links, and actions use native buttons. Sidebar links, pagination, sorting controls and avatar options have explicit focus styles. Plant Match instructions are also shown when their control receives focus.
- **Forms and images:** Search, filters and profile inputs have associated labels. Plant images use the plant name as alternative text, and profile and avatar images also include alternative text.
- **Control states:** The sort menu exposes its expanded state, and sort and avatar choices expose their selected state with ARIA attributes. Pagination announces page changes through an `aria-live="polite"` region.
- **Plant cards:** The inactive side of a flipped card is hidden from assistive technology with `aria-hidden`, and its information button is removed from the keyboard tab order.
- **Reduced motion:** The card flip and My Matches hover transitions are disabled when the user requests reduced motion.

The deployed production version received an Accessibility score of **100 in Lighthouse** in our latest reported run. Automated component tests also check selected accessible names, navigation state and sorting states. This does not establish full WCAG compliance; a complete manual keyboard and screen reader audit has not been verified here.

## Tech stack

| Part | Technology |
Expand Down Expand Up @@ -108,8 +95,6 @@ The project has three `package.json` files: one in the repo root, one in `backen
| `npm run lint` | Runs ESLint in `backend`, then in `frontend`. | Before you push or open a pull request. |
| `npm test` | Runs the frontend tests once with Vitest and exits. | Before you push or open a pull request. |

`npm run lint`, `npm test` and `npm run build` are the same checks GitHub Actions runs on every pull request, so running them locally first saves you a failed CI run.

#### Scripts in `backend` and `frontend`

You can also run scripts in one part of the project only, either with `cd backend` / `cd frontend` or with `--prefix` from the root (for example `npm run dev --prefix backend`). This is useful if you only work on one side, or want the backend and frontend output in separate terminals.
Expand All @@ -122,23 +107,9 @@ You can also run scripts in one part of the project only, either with `cd backen
| `frontend` | `npm test` | Runs Vitest in watch mode, so the tests run again every time you save a file. |
| `frontend` | `npm run preview` | Serves the production build from `dist/` locally. Run `npm run build` first. |

## Testing

See [tests.md](docs/tests.md) for what we test, how the tests are organised and how to run them.

To run all tests from the repo root:

```bash
npm test
```

Lint, tests and build also run automatically on every pull request through GitHub Actions ([.github/workflows/ci.yml](.github/workflows/ci.yml)).

TODO! The testing coverage is:

## Quality and design

See [quality.md](docs/quality.md) for our design choices, accessibility considerations, sustainable web development
See [quality.md](docs/quality.md) for Lighthouse results, testing, accessibility, design choices, sustainable web development
and work practices.

## Known issues
Expand Down
29 changes: 23 additions & 6 deletions docs/quality.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,20 @@ This document describes how we have worked to ensure the quality of the applicat

## Testing

See [tests.md](tests.md) for what we test, how the tests are organised and how to run them.

To run all tests from the repo root:

```bash
npm test
```

Lint, tests and build also run automatically on every pull request through GitHub Actions ([.github/workflows/ci.yml](../.github/workflows/ci.yml)).

TODO! The testing coverage is:

`npm run lint`, `npm test` and `npm run build` are the same checks GitHub Actions runs on every pull request, so running them locally first saves you a failed CI run.

- Snapshot tests are used to detect unintended changes to the rendered UI.

- In addition to automated testing, we manually tested the application throughout development as new features were implemented. This allowed us to evaluate usability and verify that the application behaved as intended.
Expand All @@ -35,20 +49,23 @@ For more details about individual test files, see test coverage, and instruction

## Accessibility

We considered accessibility throughout the design and development of the application.
The app includes the following accessibility features:

- **Semantic HTML and navigation:** We use semantic HTML elements such as `<nav>`, `<article>`, and headings to structure the interface. The sidebar has an accessible name, and the current page is marked with `aria-current="page"` to help users identify their location in the application.
- **Page structure:** Semantic `header`, `nav`, `main` and `article` elements organise the content. Sidebar navigation has an accessible name, and the current page is marked with `aria-current="page"`.
- **Keyboard controls:** Navigation uses links, and actions use native buttons. Sidebar links, pagination, sorting controls and avatar options have explicit focus styles. Plant Match instructions are also shown when their control receives focus.
- **Forms and images:** Search, filters and profile inputs have associated labels. Plant images use the plant name as alternative text, and profile and avatar images also include alternative text.
- **Control states:** The sort menu exposes its expanded state, and sort and avatar choices expose their selected state with ARIA attributes. Pagination announces page changes through an `aria-live="polite"` region.
- **Plant cards:** The inactive side of a flipped card is hidden from assistive technology with `aria-hidden`, and its information button is removed from the keyboard tab order.
- **Reduced motion:** The card flip and My Matches hover transitions are disabled when the user requests reduced motion.

- **Accessible interactive elements:** Interactive elements use semantic buttons and accessible names. For example, the plant card's bookmark button has a translated `aria-label`, and the information buttons allow users to reveal additional plant details.
The deployed production version received an Accessibility score of **100 in Lighthouse** in our latest reported run. Automated component tests also check selected accessible names, navigation state and sorting states.

- **Image alternative text:** Plant images use the plant name as alternative text, helping users who rely on screen readers understand the image content.
- **axe DevTools:** Axe Accessibility Testing found no automatic accessibility issues on the page when tested against WCAG 2.1 AA.

- **Colour contrast:** We tested the contrast between our chosen colours to help ensure that text and interface elements are distinguishable from their backgrounds.

- **Language support:** The application supports both Norwegian and English, allowing users to choose their preferred language.

- **Automated accessibility-related tests:** Our tests cover the sidebar navigation landmark, accessible names for interactive elements, and the active page indicator. We use queries such as `getByRole` to locate elements according to their semantic roles and accessible names.

- **Responsive layout:** We tested the application on both mobile and desktop devices. Manual testing helped us identify usability issues and make adjustments to the mobile layout.

## Sustainable web development
Expand Down
7 changes: 6 additions & 1 deletion frontend/src/components/plantCard/PlantCard.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.plant-card-flipper {
--card-name-height: clamp(68px, 8vh, 86px);
--card-name-height: clamp(100px, 8vh, 86px);
--card-image-height: 270px;
position: relative;
width: 100%;
Expand Down Expand Up @@ -247,6 +247,11 @@
overflow-y: auto;
}

.plant-card-details:focus-visible {
outline: 3px solid var(--light-green);
outline-offset: -6px;
}

.plant-card-back .plant-card-name {
height: auto;
min-height: 62px;
Expand Down
5 changes: 4 additions & 1 deletion frontend/src/components/plantCard/PlantCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ export default function PlantCard({
</article>

<article className="plant-card plant-card-back" aria-hidden={!isFlipped}>
<div className="plant-card-panel plant-card-details">
<div
className="plant-card-panel plant-card-details"
tabIndex={isFlipped ? 0 : -1}
>
<h2 className="plant-card-name">{name}</h2>

{scientificName && scientificName.length > 0 && (
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/plantMatch/PlantMatchPage.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
.plant-card-container {
position: relative;
width: 310px;
height: 520px;
height: 550px;
display: flex;
justify-content: center;
align-items: center;
Expand Down
Loading