Skip to content

fix(filter-chip): replace aria-pressed with CSS class for menu button selected state#580

Merged
saiponnada merged 5 commits into
eBay:mainfrom
voidmatcha:fix/452
Apr 17, 2026
Merged

fix(filter-chip): replace aria-pressed with CSS class for menu button selected state#580
saiponnada merged 5 commits into
eBay:mainfrom
voidmatcha:fix/452

Conversation

@voidmatcha
Copy link
Copy Markdown
Contributor

Description

Notes

Menu filter-chips used aria-pressed to show selected state. That's the wrong attribute here - aria-pressed is for buttons that toggle their own state on/off, but a menu chip reflects a selection made inside another UI element. Screen readers were announcing a pressed state that had nothing to do with the button itself.

Two changes:

  1. CSS — added filter-chip--selected class as a selector for selected state and animation, alongside the existing aria-pressed="true". Menu chips can now drop aria-pressed without losing visual feedback.
  2. Stories — removed aria-pressed from all menu button chip examples, added filter-chip--selected class and <span class="clipped">filter applied</span> so screen readers announce filter state correctly.

Non-menu chips (no aria-expanded) still use aria-pressed as before.

As-Is
<button class="filter-chip" aria-pressed="true">
To-Be
<button class="filter-chip filter-chip--selected"> + <span class="clipped">filter applied</span>

Screenshots

Checklist

Checklist

  • I verify all changes are within scope of the linked issue
  • I added/updated/removed testing (Storybook in Skin) coverage as appropriate
  • I tested the UI in all supported browsers
  • I tested the UI in dark mode and RTL mode

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 25, 2026

🦋 Changeset detected

Latest commit: 4660537

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

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

@ArtBlue
Copy link
Copy Markdown
Contributor

ArtBlue commented Mar 25, 2026

We probably need updates on the React and Marko sides as well, right @HenriqueLimas and @LuLaValva ?

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Skin filter-chip “menu button” pattern to avoid misusing aria-pressed (which implies a self-toggling button) by switching the visual selected state to a CSS modifier class and updating Storybook examples accordingly.

Changes:

  • Adds .filter-chip--selected support in filter-chip.scss for selected styling/animation alongside the existing [aria-pressed="true"] selectors.
  • Updates the menu-button filter-chip Storybook stories to remove aria-pressed, apply .filter-chip--selected for selected examples, and add clipped “filter applied” text.
  • Adds a changeset for @ebay/skin (patch).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
packages/skin/src/sass/filter-chip/stories/menu-button-chip.stories.js Updates menu filter-chip Storybook markup to stop using aria-pressed and provide SR-friendly selected-state text.
packages/skin/src/sass/filter-chip/filter-chip.scss Adds .filter-chip--selected as an alternative selected-state selector for buttons (and animated variant).
.changeset/loose-lizards-drop.md Declares a patch release note for the Skin package.

Comment thread packages/skin/src/sass/filter-chip/filter-chip.scss
Comment on lines 1 to 5
export default { title: "Skin/Filter Chip/Menu" };

export const collapsed = () => `
<button class="filter-chip" aria-expanded="false" aria-pressed="false">
<button class="filter-chip" aria-expanded="false">
<span class="filter-chip__text">Football</span>
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

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

The PR description/issue notes indicate menu filter-chip examples should drop aria-pressed and rely on .filter-chip--selected + clipped text. However, the website docs example at src/routes/_index/components/filter-chip/css+page.marko (Menu Button Chip section) still uses aria-pressed on the menu button markup, which leaves the documented pattern inconsistent with the updated Skin stories/CSS. Update the docs example to match the new guidance.

Copilot uses AI. Check for mistakes.

export const collapsed = () => `
<button class="filter-chip" aria-expanded="false" aria-pressed="false">
<button class="filter-chip" aria-expanded="false">
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

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

Consider adding type="button" to these <button> examples. Without an explicit type, buttons default to submit when placed inside a form, which can cause unexpected behavior for consumers copying the markup from Storybook.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

@saiponnada saiponnada left a comment

Choose a reason for hiding this comment

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

Thanks @dididy for taking this up. Few things pending,

  • We need examples in skin stories for expressive variant(with aria-pressed but no aria-expanded)
  • Also update the docs under filter-chip/css+page.marko
  • Implementations on both Marko and React and add corresponding tests.

If you want to close this out, we’re happy to take it on—especially if working across the frameworks isn’t convenient on your side.

Comment thread packages/skin/src/sass/filter-chip/filter-chip.scss
@voidmatcha
Copy link
Copy Markdown
Contributor Author

Addressed all the review feedback!

The build has some ebay-date-textbox snapshot failures, but the same thing happens on main — not related to this PR.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 9, 2026

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@be9b9c5). Learn more about missing BASE report.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #580   +/-   ##
=======================================
  Coverage        ?   41.05%           
=======================================
  Files           ?     2114           
  Lines           ?    11350           
  Branches        ?     1640           
=======================================
  Hits            ?     4660           
  Misses          ?     6320           
  Partials        ?      370           

☔ 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.

@saiponnada saiponnada closed this Apr 13, 2026
@saiponnada saiponnada reopened this Apr 13, 2026
Copy link
Copy Markdown
Contributor

@saiponnada saiponnada left a comment

Choose a reason for hiding this comment

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

Overall LGTM! Thanks for making these changes. We have minor knits to fix and good to merge IMO.

Comment thread .changeset/loose-lizards-drop.md
Comment thread src/routes/_index/components/filter-chip/css+page.marko Outdated
Comment thread packages/ebayui-core-react/src/ebay-filter-chip/filter-chip.tsx Outdated
@voidmatcha
Copy link
Copy Markdown
Contributor Author

All addressed. thanks for the review! 🙏

Copy link
Copy Markdown
Contributor

@saiponnada saiponnada left a comment

Choose a reason for hiding this comment

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

LGTM!

@saiponnada saiponnada merged commit ef749dc into eBay:main Apr 17, 2026
5 checks passed
@github-actions github-actions Bot mentioned this pull request Apr 17, 2026
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.

filter-chip: incorrectly uses aria-pressed for menu button

5 participants