feat: Extract component description from aria-describedby#220
Merged
Conversation
3b89535 to
c2665f9
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #220 +/- ##
==========================================
+ Coverage 98.97% 98.99% +0.01%
==========================================
Files 44 44
Lines 1272 1293 +21
Branches 351 337 -14
==========================================
+ Hits 1259 1280 +21
- Misses 12 13 +1
+ Partials 1 0 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
44e36e4 to
0643df9
Compare
Add description field to component metadata tree output. When a component has a label extracted, the toolkit now also resolves aria-describedby on the first child element that has it, concatenating all referenced IDs' text content (matching screen reader behavior). This enables consumers like the page scanner to access constraint text, descriptions, and other accessible descriptions alongside labels.
0643df9 to
fae39d1
Compare
amanabiy
approved these changes
May 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds a
descriptionfield to the component metadata tree output. The description is extracted by resolvingaria-describedbyon the same element used for label resolution (found via the component's label selector). All space-separated IDs are resolved and their text content concatenated, matching screen reader behavior.This works because
aria-labelledbyandaria-describedbyare always placed on the same interactive control element in Cloudscape components. FormField is correctly excluded since its label selector points to a<label>element which does not havearia-describedby.Example output
For an Input inside a FormField with
constraintText="Must be 3-20 characters":{ "name": "awsui.Input", "label": "Username", "description": "Must be 3-20 characters", "properties": { "value": "..." } }Changes
description?: stringtoGeneratedAnalyticsMetadataComponentTreeinterfaceresolveComponentDescriptionhelper that uses the label selector to find the element, checksaria-describedby, and concatenates all referenced IDs' text content. Iterates through array selectors (like label resolution) returning the first match.processMetadata: description is extracted when a component hasnameand a label selector definedTesting
All 412 unit tests pass.
Components unit tests in dry run expected to fail because 1) of as-yet in-pipeline diffs from a previous PR, 2) expected diffs from this PR (
descriptionnow provided in some of the test cases)