Skip to content

feat: Extract available options/items for selection components in page scanner#219

Open
gethinwebster wants to merge 1 commit into
mainfrom
feat/page-scanner-item-extraction
Open

feat: Extract available options/items for selection components in page scanner#219
gethinwebster wants to merge 1 commit into
mainfrom
feat/page-scanner-item-extraction

Conversation

@gethinwebster
Copy link
Copy Markdown
Member

@gethinwebster gethinwebster commented May 19, 2026

Description

Add DOM-based extraction of available options/items to the page scanner for selection-style components. This enables page scanner consumers to see all available choices on a page, not just the currently selected ones.

Components affected:

  • awsui.RadioGroup / awsui.Tiles / awsui.Cards: new options property — Array<{value, label, description?}>
  • awsui.Tabs: new tabs property — Array<{value, label, disabled?}>
  • awsui.Table: new rows property — Array<Array<string>> (opt-in via includeAllTableRows option)

API change:
getComponentsTree now accepts an optional second parameter GetComponentsTreeOptions:

interface GetComponentsTreeOptions {
  includeAllTableRows?: boolean;
}
getComponentsTree(node?, options?)

The extraction uses stable ARIA semantics (aria-labelledby, aria-label, aria-describedby, aria-disabled) and existing DOM structure — no changes required to component source code.

Related links, issue #, if available: n/a

How has this been tested?

  • 9 new unit tests covering all extraction helpers (RadioGroup, Tiles, Cards, Tabs with disabled state, Table rows with/without opt-in)
  • All 107 existing unit tests continue to pass
  • TypeScript compilation passes cleanly
  • Full build passes
Review checklist

Correctness

  • Changes are backward-compatible — getComponentsTree second parameter is optional, existing callers are unaffected.
  • No new browser features used — relies on standard DOM APIs (querySelectorAll, getAttribute, getElementById).
  • No accessibility impact — read-only extraction, no DOM mutations.

Testing

  • Changes are covered with new unit tests (9 tests in metadata-utils.test.ts).
  • Integration tests not applicable — page scanner is a utility function.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.97%. Comparing base (7794be8) to head (9cf66dc).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #219      +/-   ##
==========================================
+ Coverage   98.90%   98.97%   +0.07%     
==========================================
  Files          44       44              
  Lines        1190     1272      +82     
  Branches      320      348      +28     
==========================================
+ Hits         1177     1259      +82     
  Misses         12       12              
  Partials        1        1              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@gethinwebster gethinwebster force-pushed the feat/page-scanner-item-extraction branch 6 times, most recently from ba3a78f to 8ac882e Compare May 20, 2026 07:20
…abs, and Table

Add DOM-based extraction of available items to the page scanner for
selection-style components. This enables consumers to see all available
choices, not just the currently selected one.

Components affected:
- RadioGroup/Tiles: options array with {value, label, description?}
- Cards: items array with {value, label, description?}
- Tabs: tabs array with {value, label, position}
- Table: rows array (opt-in via includeTableData option)

The getComponentsTree function now accepts an optional second parameter
GetComponentsTreeOptions to control opt-in features like table data.
@gethinwebster gethinwebster force-pushed the feat/page-scanner-item-extraction branch from 8ac882e to 9cf66dc Compare May 20, 2026 09:48
@gethinwebster
Copy link
Copy Markdown
Member Author

"Components unit tests" are expected to fail, as those are snapshot tests that use/verify this scanner output. To merge we will temporarily disable checks then update snapshot & re-enable.

@gethinwebster gethinwebster marked this pull request as ready for review May 20, 2026 10:27
@gethinwebster gethinwebster requested a review from a team as a code owner May 20, 2026 10:27
@gethinwebster gethinwebster requested review from avinashbot and removed request for a team May 20, 2026 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant