Skip to content

Commit

Permalink
fix: add aria-expanded attribute to emoji picker and reactions select…
Browse files Browse the repository at this point in the history
…or (#2274)

### 🎯 Goal

This fixes an accessibility issue with the `EmojiPicker` and reactions
selector: their respective tigger buttons should have `aria-expanded`
attribute, as per the [Menu Button ARIA
pattern](https://www.w3.org/WAI/ARIA/apg/patterns/menu-button/).

### 🎨 UI Changes

No visible changes.
  • Loading branch information
myandrienko committed Feb 14, 2024
1 parent ab60833 commit b15cdd5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/components/Emojis/EmojiPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export const EmojiPicker = (props: EmojiPickerProps) => {
</Tooltip>
)}
<button
aria-expanded={displayPicker}
aria-label='Emoji picker'
className={props.buttonClassName ?? buttonClassName}
onClick={() => setDisplayPicker((cv) => !cv)}
Expand Down
2 changes: 2 additions & 0 deletions src/components/Message/MessageOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ const UnMemoizedMessageOptions = <
initialMessage,
message,
onReactionListClick,
showDetailedReactions,
threadList,
} = useMessageContext<StreamChatGenerics>('MessageOptions');

Expand Down Expand Up @@ -96,6 +97,7 @@ const UnMemoizedMessageOptions = <
)}
{shouldShowReactions && (
<button
aria-expanded={showDetailedReactions}
aria-label='Open Reaction Selector'
className={`str-chat__message-${theme}__actions__action str-chat__message-${theme}__actions__action--reactions str-chat__message-reactions-button`}
data-testid='message-reaction-action'
Expand Down

0 comments on commit b15cdd5

Please sign in to comment.