Skip to content

Conversation

@cdransf
Copy link
Member

@cdransf cdransf commented Nov 6, 2025

Description

Fixed accessibility violations in the <sp-clear-button> documentation by adding the required label attribute to all examples. The component implementation already correctly handles the label attribute (via the LikeAnchor mixin), but the documentation examples were missing it, causing WCAG 2.1 Level A violations (4.1.2 Name, Role, Value) when rendered on the documentation site.

Additionally:

  • Corrected misleading documentation that suggested slot content could be used for labels (the ClearButton overrides buttonContent and does not render slot content)
  • Fixed JSDoc in ClearButton.ts to accurately document the label attribute instead of the non-functional slot
  • Added three new accessibility tests to verify aria-label behavior
  • Fixed grammar: "only close icon" → "only a close icon"

Motivation and context

Users running Axe DevTools on https://swcpreviews.z13.web.core.windows.net/pr-5861/docs/components/clear-button reported "ARIA commands must have an accessible name" violations. The clear button examples were missing the label attribute, which is the only way to provide an accessible name since the component only renders an icon (no slot content).

Related issue(s)

  • Reported via accessibility audit using Axe DevTools Chrome extension

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

Manual review test cases

  • Verify all clear-button examples on documentation page have accessible names

    1. Navigate to https://opensource.adobe.com/spectrum-web-components/components/clear-button/
    2. Run Axe DevTools browser extension
    3. Expect no "ARIA commands must have an accessible name" violations for clear buttons
  • Verify clear button aria-label is set correctly

    1. Inspect any <sp-clear-button label="Clear"> element
    2. Check the rendered HTML attributes
    3. Expect role="button" and aria-label="Clear" on the host element

@cdransf cdransf self-assigned this Nov 6, 2025
@changeset-bot
Copy link

changeset-bot bot commented Nov 6, 2025

⚠️ No Changeset found

Latest commit: 33b07cf

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@cdransf cdransf added the Status: WIP PR is a work in progress or draft label Nov 6, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 6, 2025

📚 Branch Preview

🔍 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-5861

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.

@cdransf cdransf added Status: Ready for review PR ready for review or re-review. and removed Status: WIP PR is a work in progress or draft labels Nov 6, 2025
@cdransf cdransf marked this pull request as ready for review November 6, 2025 20:44
@cdransf cdransf requested a review from a team as a code owner November 6, 2025 20:44
Copy link
Contributor

@nikkimk nikkimk left a comment

Choose a reason for hiding this comment

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

LGTM

@caseyisonit
Copy link
Contributor

caseyisonit commented Nov 10, 2025

📚 Branch Preview

The documentation site is not reflecting the changes in the markdown. im going to check it out locally but we might need to investigate why thats not working

@caseyisonit
Copy link
Contributor

Screenshot 2025-11-10 at 9 51 20 AM

Probably a follow up ticket but the docs site for clear button is rendering the default button demo at the top and not a close button

@Rajdeepc
Copy link
Contributor

Rajdeepc commented Nov 11, 2025

📚 Branch Preview

The documentation site is not reflecting the changes in the markdown. im going to check it out locally but we might need to investigate why thats not working

The documentation system (copy-component-docs.js) looks for template.js/ts in the package directory's stories/ folder, not the parent package.

Currently:

  • clear-button.md lives in packages/button/clear-button.md
  • Documentation system processes it as component clear-button with package button
  • It looks for template at: packages/button/stories/template.js
  • That template only renders <sp-button>, not <sp-clear-button> as here

There are several ways to tackle this but would be a good follow up fix.

@cdransf cdransf force-pushed the cdransf/clear-button-name branch 2 times, most recently from 72d949e to 619e7f0 Compare November 12, 2025 22:27
@cdransf cdransf requested review from a team, Rajdeepc and caseyisonit November 12, 2025 22:27
@cdransf cdransf force-pushed the cdransf/clear-button-name branch from 619e7f0 to 33b07cf Compare November 13, 2025 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status: Ready for review PR ready for review or re-review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants