google / google/model-viewer

Potential focus visibility issue in annotations/hotspots

Open Beginner friendly
#5,192 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
8.2k
Forks
947
PR merge metrics
No merged PRs in 30d

Description

## Potential a11y issue

Annotations may fail WCAG [Focus Visible](https://www.w3.org/WAI/WCAG22/Understanding/focus-visible.html) and/or [Focus Appearance](https://www.w3.org/WAI/WCAG22/Understanding/focus-appearance) on focus.

### Steps to reproduce:

1. Go to https://modelviewer.dev/examples/annotations/#cameraViews
2. Tab to the first annotation/hotspot
3. Notice how the focused annotation element and belonging focus outline is barely visible:

Image

### Relevant CSS:

https://github.com/google/model-viewer/blob/297ed2bdbea0c8f921d985ff0c71afd3a819e12e/packages/model-viewer/src/template.ts#L106-L108

## Potential solution

We can ensure the element and focus outline is visible on focus by not changing the opacity if there's [focus-within](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Selectors/:focus-within) the slotted annotation wrapper:

```css
.annotation-wrapper.hide ::slotted(:not(:focus-within)) {
opacity: var(--min-hotspot-opacity, 0.25);
}
```

### Result:

The annotation and focus outline is now fully visible if there's focus within:

Image

## Disclaimer

I'm not personally a user of ``, I'm here mostly due to @svinkle's model a11y work and my interest in [the `` element proposal](https://github.com/immersive-web/model-element).

Contributor guide

Open the contributing guide

Research direction

Start with packages/model-viewer/src/template.ts around lines 106-108 and reproduce the issue at modelviewer.dev/examples/annotations/#cameraViews by tabbing to the first annotation. Adjust the focus-related visibility behavior described in the issue, then verify that the annotation and its focus outline remain clearly visible when focus is within the slotted wrapper.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
accessibility
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
88/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.