fix(fuselage): expose `IconButton` pressed state through `aria-pressed`
Proposed changes (including videos or screenshots)
IconButton's pressed prop only added the -pressed classes, so assistive technology never heard the toggle state unless the caller also passed aria-pressed — and most Rocket.Chat callers (e.g. the sidebar toggler) do not.
IconButton now sets aria-pressed from pressed:
pressed | aria-pressed | Announced as |
|---|---|---|
true | "true" | toggle button, pressed |
false | "false" | toggle button, not pressed |
| omitted | not set | plain button (unchanged) |
aria-pressed is only set when the element is a button (no role, or role='button'). An IconButton with another role, such as the emoji picker's category tabs (role='tab'), already announces its state through that role (aria-selected), so pressed keeps only styling it there.
A caller's own aria-pressed is spread after it, so it still takes precedence. Visual behavior is unchanged.
pressed: true | pressed: false |
|---|---|
![]() | ![]() |
Issue(s)
Closes #42807
Steps to test or reproduce
cd packages/fuselage && yarn jest src/components/Button/IconButton.spec.tsx— the newpressed,pressed={false}and non-buttonroletests fail without this change.yarn storybookinpackages/fuselage→ Inputs → IconButton → Icon Button, toggle thepressedcontrol and inspect the button:aria-pressedfollows it, and disappears when the control is reset.- In the app, collapse the window below the sidebar breakpoint and inspect the sidebar toggle (burger) button:
aria-pressedflips between"false"and"true"as the sidebar opens. The emoji picker category tabs keep onlyaria-selected.
Further comments
The behavior was unchanged from Fuselage 0.96.0, so it was out of scope for #42763, where it was found.
🤖 Generated with Claude Code
Summary by CodeRabbit
- Accessibility
- Icon buttons now announce their pressed or released toggle state to assistive technologies.
- Caller-provided
aria-pressedvalues remain supported. - Toggle-state announcements use role-appropriate accessibility attributes, avoiding
aria-pressedfor non-button roles.
- Bug Fixes
- Improved accessibility behavior for toggle-style icon buttons.

