DiamondLightSource / DiamondLightSource/smartem-devtools

a11y: keyboard access for interactive spatial views (atlas, square, latent space)

Open
#100 1 comment 0 reactions 0 assignees View on GitHub
smartem-frontend
Dominant language
TypeScript
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Retargeted. This issue originally listed three findings, all in `app/routes/squareLR.tsx` in
the legacy front end. That app was removed in smartem-frontend#136 and the file no longer
exists, so the original findings are moot. Reviewing them against the current front end
(per the earlier comment: "see if any of this applied to the new f/e, recycle or dismiss"),
one of the three carries over.

## Dismissed - now structurally prevented

**Missing alt text** and **SVG without ``** cannot recur silently. `biome.json` sets
`recommended: true` with the a11y group active, lint is enforced in CI, and
`biome lint apps/smartem/src packages` currently passes with zero findings. There are no
`<img>` elements without `alt` in the codebase.

## Recycled - interactive elements without keyboard support

The original third finding (interactive SVG elements reachable only by mouse) has reappeared in
the new spatial components. Running the full a11y rule group reports:

```
apps/smartem/src/components/spatial/AtlasMap.tsx:318 noNoninteractiveElementInteractions
apps/smartem/src/components/spatial/SquareMap.tsx:481 noNoninteractiveElementInteractions
apps/smartem/src/components/spatial/AtlasMap.tsx:371 useSemanticElements
apps/smartem/src/components/spatial/SquareMap.tsx:550 useSemanticElements
apps/smartem/src/components/spatial/LatentSpacePanel.tsx:143 useSemanticElements
```

The practical consequence: the atlas and square maps are the primary navigation surface, and
grid squares are selected by clicking SVG shapes. Those targets cannot currently be reached or
activated by keyboard, so keyboard-only and screen-reader users have no route into the
per-square views at all.

## Why CI does not catch this

Neither rule is active under the current configuration:

- `noNoninteractiveElementInteractions` is not part of Biome's `recommended` set, so it never
runs unless explicitly enabled.
- `useSemanticElements` is explicitly switched off in `biome.json`.

Worth confirming whether disabling `useSemanticElements` was a deliberate decision for the
spatial components (where a semantic element may genuinely not fit inside an SVG) or was
inherited. If deliberate, the exception is better expressed narrowly than globally.

## Scope

- Make grid squares and foil holes focusable and activatable by keyboard in `AtlasMap` and
`SquareMap`, with a visible focus indicator that works against the underlying imagery.
- Decide the interaction model for a dense SVG map before implementing - tabbing through
several hundred foil holes individually would be worse than no keyboard access. Roving
tabindex over squares, with arrow-key traversal within a square, is the likely shape.
- Apply the same treatment to `LatentSpacePanel`.
- Once the components conform, enable the corresponding rules in `biome.json` so the class of
problem stays fixed rather than recurring.

## Priority

Real but not urgent, and honestly assessed: the enforced rules already cover the common cases,
and this affects an internal scientific tool with a small known user base. It is recorded here
so the gap is known rather than rediscovered.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.