Skip to content

feat(core): selection controller#6402

Open
nikkimk wants to merge 28 commits into
mainfrom
nikkimk/poc-selection-controller
Open

feat(core): selection controller#6402
nikkimk wants to merge 28 commits into
mainfrom
nikkimk/poc-selection-controller

Conversation

@nikkimk

@nikkimk nikkimk commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Description

  • Proof-of-concept for a controller to handle single or multi-selection.
  • Documentation with demos and code snippets for implementing the controller.
  • Refactor of 2nd-gen tabs to leverage focus group navigation and selection controllers.

Motivation and context

This controller could handle selection for tabs, accordions, radio groups, swatch groups with selectable swatches, button groups that function as radio groups, menus, and pickers.

Related issue(s)

  • fixes SWC-2098

Screenshots (if appropriate)


Author's checklist

  • I have read the CONTRIBUTING and PULL_REQUESTS documents.
  • I have reviewed at the Accessibility Practices for this feature, see: Aria Practices
  • I have added automated tests to cover my changes.
  • I have included a well-written changeset if my change needs to be published.
  • I have included updated documentation if my change required it.

Reviewer's checklist

  • Includes a Github Issue with appropriate flag or Jira ticket number without a link
  • Includes thoughtfully written changeset if changes suggested include patch, minor, or major features
  • Automated tests cover all use cases and follow best practices for writing
  • Validated on all supported browsers
  • All VRTs are approved before the author can update Golden Hash

Manual review test cases

  • Selection Controller

    1. Checkout the branch (selection controller docs only show in internally dev mode).
    2. Start second gen storybook locally.
    3. Verify that the documentation is sufficient and the examples work as they should.
    4. Verify that automated tests pass.
    5. Verify the examples pass manual keyboard and screenreader testing.
  • Tabs

    1. Go to Tabs documentation
    2. Verify that the examples work.
    3. Verify that the public API has not changed.
    4. Verify no visual regressions.
    5. Verify that automated tests pass.
    6. Verify the examples pass manual keyboard and screenreader testing.
  • Is the creation and implementation of this controller useful for tabs, accordions, radio groups, swatch groups with selectable swatches, button groups that function as radio groups, menus, and pickers? Or is it easier just to let each custom element handle its own selection management?

Device review

  • Did it pass in Desktop?
  • Did it pass in (emulated) Mobile?
  • Did it pass in (emulated) iPad?

@nikkimk nikkimk self-assigned this Jun 12, 2026
@changeset-bot

changeset-bot Bot commented Jun 12, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7ec56a7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@adobe/spectrum-wc Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actions Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

📚 Branch Preview Links

🔍 First Generation Visual Regression Test Results

When a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:

Deployed to Azure Blob Storage: pr-6402

If the changes are expected, update the current_golden_images_cache hash in the circleci config to accept the new images. Instructions are included in that file.
If the changes are unexpected, you can investigate the cause of the differences and update the code accordingly.

@nikkimk nikkimk marked this pull request as ready for review June 15, 2026 15:07
@nikkimk nikkimk requested a review from a team as a code owner June 15, 2026 15:07
@nikkimk nikkimk added the Status:Ready for review PR ready for review or re-review. label Jun 15, 2026
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
<DocsFooter />
```

#### Controller MDX template

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Controllers require different documentation, like how to use them with a host, so they should have different rules.

10. **BEHAVIORS STORIES** - Built-in functionality (if applicable)
11. **ACCESSIBILITY STORIES** - A11y demonstration

#### Controller section order

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Controllers require different documentation, like how to use them with a host, so they should have different rules.

const items = this.getEligibleItems();
if (items.length === 0) {
for (const el of this.getRawItems()) {
// getRawItems() calls getItems() which may return [] when the host

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Needed to make adjustments once the controller was implemented with a host that can be disabled.

// Fall back to event.code when event.key is empty (synthetic test events).
// Real browser events always populate event.key, so this never affects
// numpad disambiguation (e.g. Numpad6 NumLock-off sets key='ArrowRight').
const key = event.key || event.code;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

When used with selection controller, there were issues with conflicts in keyboard events.

nikkimk and others added 8 commits June 15, 2026 11:44
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ies (#6403)

* feat(*): rename /shared to /_lit-styles

* docs(css, ai): document process and features of shared style directories
* docs(color-handle): accessbility migration-analysis

* docs(color-handle): added notes from adobe a11y

* docs(color-loupe): added adaptive border guidance
…pectrum-web-components into nikkimk/poc-selection-controller
nikkimk and others added 5 commits June 15, 2026 12:00
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…pectrum-web-components into nikkimk/poc-selection-controller
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@nikkimk nikkimk changed the title feat(core): proof-of-concept selection controller feat(core): selection controller Jun 16, 2026
@nikkimk nikkimk added the High priority PR review PR is a high priority and should be reviewed ASAP label Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

High priority PR review PR is a high priority and should be reviewed ASAP Status:Ready for review PR ready for review or re-review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants