Potential focus visibility issue in annotations/hotspots

Open Beginner friendly
#5,192 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

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.

Description

Potential a11y issue

Annotations may fail WCAG Focus Visible and/or 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 the slotted annotation wrapper:

.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 <model-viewer>, I'm here mostly due to @svinkle's model a11y work and my interest in the <model> element proposal.

Dominant language
TypeScript
Stars
8.2k
Forks
949
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from google/model-viewer

All issues in google/model-viewer

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.