Skip to content

Restore altText to v0.8 and make specifications match implementations.#993

Merged
gspencergoog merged 8 commits intogoogle:mainfrom
gspencergoog:add_image_description
Mar 26, 2026
Merged

Restore altText to v0.8 and make specifications match implementations.#993
gspencergoog merged 8 commits intogoogle:mainfrom
gspencergoog:add_image_description

Conversation

@gspencergoog
Copy link
Copy Markdown
Collaborator

@gspencergoog gspencergoog commented Mar 26, 2026

Description

In a recent refactor, I removed the altText from the Angular v0.8 Image component because it wasn't part of the specification, but I've since seen that it was actually in common usage (not really surprising, in retrospect), so I've added it back, and retroactively added it to the Image component schema in the v0.8 specification.

For the v0.9 specification, it also didn't exist, but there was already a description implemented for some renderers on the Image component which served that same purpose, but without being in the specification. So I've added description to the v0.9 and v0.10 specifications. The name change to "description" makes sense to me because it describes what should be in that field, making it self-documenting to an LLM. I'm sure an LLM also knows what "alt text" is, but this would keep it more general and not web-centric.

I've also implemented altText/description for the React and Lit renderers (which are using v0.9 and v0.8, respectively).

Slider Accessibility and Label Standardization (v0.8)

In addition to the Image accessibility changes, this PR also standardizes the Slider component's label property in v0.8:

  • Specification Updates: Added the label property to both server_to_client_with_standard_catalog.json and standard_catalog_definition.json for v0.8 using the dynamic string pattern (supporting both literal strings and data paths).
  • Renderer Updates:
    • Angular: Made the label input optional (removed .required) and updated the template to render it conditionally using @if.
    • Lit: Updated the template to use extractStringValue (supporting dynamic paths) and render conditionally only when provided.
    • React: Updated the template to render the <label> conditionally only when non-empty.

This ensures that label is optional across all renderers and behaving consistently for v0.8. Tests have been verified for all modified packages.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces accessibility support for image components across the Angular, Lit, and React renderers by adding altText or description properties. The changes include logic to resolve these properties from literal strings or data paths, updates to component templates, and corresponding specification updates for versions 0.8, 0.9, and 0.10. Unit tests have been added to verify the correct rendering of alt text, and the React renderer version has been bumped to 0.8.1. I have no feedback to provide.

Comment on lines +86 to +90
"@angular/core": "^21.2.5",
"@types/node": "^24.11.0",
"c8": "^11.0.0",
"gts": "^7.0.0",
"rxjs": "^7.8.2",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

It appears that @angular/core and rxjs have been added to the devDependencies in the package-lock.json for the React renderer. These are typically Angular-specific dependencies and seem out of place in a React project. Please verify if these dependencies are truly necessary for the React renderer's development environment. If not, they should be removed to avoid unnecessary package bloat and potential conflicts.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. All I did here was run "npm install", so they were somehow already dependencies.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have removed rxjs: it is unused in the React renderer.

@angular/core is a transitive dependency. It isn't listed in react/package.json but it is in package-lock.json because web_core (which react depends on locally via a file: relationship) lists it as a devDependency to test its reactivity system against Angular Signals.

@gspencergoog gspencergoog changed the title Restore altText to v0.8 and add description to v0.9 and v0.10. Restore altText to v0.8 and make specifications match implementations. Mar 26, 2026
Copy link
Copy Markdown
Collaborator

@jacobsimionato jacobsimionato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks!

@gspencergoog gspencergoog merged commit 214bb43 into google:main Mar 26, 2026
16 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in A2UI Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants