Skip to content

Commit

Permalink
fix(a11y): assign correct role when collapsible prop is 'icon' or 'he…
Browse files Browse the repository at this point in the history
…ader' (#353)
  • Loading branch information
aojunhao123 authored Oct 28, 2024
1 parent 44a5d48 commit d403776
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ const CollapsePanel = React.forwardRef<HTMLDivElement, CollapsePanelProps>((prop
'aria-disabled': disabled,
onKeyDown: handleKeyDown,
style: styles.header,
role: accordion ? 'tab' : 'button',
};

if (!collapsibleHeader && !collapsibleIcon) {
headerProps.onClick = handleItemClick;
headerProps.role = accordion ? 'tab' : 'button';
headerProps.tabIndex = disabled ? -1 : 0;
}

Expand Down

0 comments on commit d403776

Please sign in to comment.