Skip to content

fix: add aria-pressed semantics to selectable Tag, remove default aria-pressed from InteractionTag #34619

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

smhigley
Copy link
Contributor

@smhigley smhigley commented Jun 9, 2025

Previous Behavior

There were two separate issues with selected semantics on Tag and InteractionTag:

  • All InteractionTags were getting aria-pressed defined, because handleTagSelect was always defined on the parent context
  • Tag + selected="true/false" did not have any selection semantics

New Behavior

  • InteractionTag does not always have aria-pressed set, and handleTagSelect defaults to undefined instead of an empty function
  • Tag adds either aria-pressed or aria-selected based on parent TagGroup semantics + whether the selected prop is a boolean and not undefined

There is still a remaining issue that InteractionTag sets selection semantics based on handleTagSelect alone, and doesn't respond to directly setting selected, which is a bit harder to fix than with Tag since the context and state types currently require it to be a boolean. This probably needs a bit more investigation (tagging @ValentinaKozlova for her opinion)

Related Issue(s)

@smhigley smhigley requested review from ValentinaKozlova and a team as code owners June 9, 2025 23:30
Copy link

github-actions bot commented Jun 9, 2025

📊 Bundle size report

Package & Exports Baseline (minified/GZIP) PR Change
react-components
react-components: entire library
1.231 MB
310.272 kB
1.231 MB
310.316 kB
96 B
44 B
react-tags
InteractionTag
15.506 kB
6.232 kB
15.504 kB
6.233 kB
-2 B
1 B
react-tags
Tag
30.306 kB
9.905 kB
30.402 kB
9.945 kB
96 B
40 B
Unchanged fixtures
Package & Exports Size (minified/GZIP)
react-components
react-components: Button, FluentProvider & webLightTheme
69.732 kB
20.259 kB
react-components
react-components: Accordion, Button, FluentProvider, Image, Menu, Popover
227.58 kB
65.885 kB
react-components
react-components: FluentProvider & webLightTheme
44.567 kB
14.62 kB
react-portal-compat
PortalCompatProvider
8.386 kB
2.624 kB
react-tag-picker
@fluentui/react-tag-picker - package
188.73 kB
56.597 kB
react-tags
TagGroup
84.031 kB
24.92 kB
react-timepicker-compat
TimePicker
110.6 kB
36.56 kB
🤖 This report was generated against b6ae6dd16f5c518d5070642dc13cf739ce7f5ff1

Copy link

github-actions bot commented Jun 9, 2025

Pull request demo site: URL

@ValentinaKozlova
Copy link
Contributor

Hey @smhigley, what do you mean that "doesn't respond to directly setting selected"? I checked it from your branch, looks like everything works fine. Writing to you offline :)

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.

2 participants