Skip to content

Commit 58c7f8a

Browse files
committed
fix: a11y violation
1 parent bd0236e commit 58c7f8a

2 files changed

Lines changed: 44 additions & 14 deletions

File tree

packages/fuselage/src/components/SidebarV2/Sidebar.styles.scss

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ $sidebar-color-stroke-extra-light: theme(
121121

122122
&__bar:hover &__menu-wrapper,
123123
&__bar:focus-within &__menu-wrapper,
124-
&__bar:has([aria-expanded='true']) &__menu-wrapper {
124+
&__bar:has(&__menu-wrapper [aria-expanded='true']) &__menu-wrapper {
125125
width: lengths.size(20);
126126

127127
opacity: 1;
@@ -148,8 +148,32 @@ $sidebar-color-stroke-extra-light: theme(
148148
}
149149
}
150150

151-
&-collapse-group__panel--expanded {
152-
padding-block: lengths.padding(none);
151+
&-collapse-group {
152+
&__bar-button {
153+
display: flex;
154+
align-items: center;
155+
156+
flex: 1 1 0;
157+
158+
min-width: 0;
159+
160+
text-align: start;
161+
162+
column-gap: lengths.padding(4);
163+
164+
&[tabindex] {
165+
@include clickable;
166+
@include focus-state($shadow: false);
167+
}
168+
}
169+
170+
&__bar:has(&__bar-button:hover) {
171+
background-color: colors.surface(tint);
172+
}
173+
174+
&__panel--expanded {
175+
padding-block: lengths.padding(none);
176+
}
153177
}
154178

155179
&-accordion-item {

packages/fuselage/src/components/SidebarV2/SidebarGroupTitle.tsx

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export const SidebarGroupTitle = ({
2020
menu,
2121
barProps,
2222
expanded,
23+
role,
2324
...props
2425
}: SidebarGroupTitleProps) => (
2526
<div
@@ -29,19 +30,24 @@ export const SidebarGroupTitle = ({
2930
]
3031
.filter(Boolean)
3132
.join(' ')}
32-
{...barProps}
3333
{...props}
3434
>
35-
{expanded !== undefined && <Chevron size='x20' right={!expanded} />}
36-
{title && (
37-
<h4
38-
className='rcx-box rcx-box--full rcx-sidebar-v2-collapse-group__title'
39-
id={titleId}
40-
>
41-
{title}
42-
</h4>
43-
)}
44-
{!expanded && badge && badge}
35+
<div
36+
className='rcx-box rcx-sidebar-v2-collapse-group__bar-button'
37+
role={role}
38+
{...barProps}
39+
>
40+
{expanded !== undefined && <Chevron size='x20' right={!expanded} />}
41+
{title && (
42+
<h4
43+
className='rcx-box rcx-box--full rcx-sidebar-v2-collapse-group__title'
44+
id={titleId}
45+
>
46+
{title}
47+
</h4>
48+
)}
49+
{!expanded && badge && badge}
50+
</div>
4551
{menu && <SidebarCollapseGroupMenu>{menu}</SidebarCollapseGroupMenu>}
4652
</div>
4753
);

0 commit comments

Comments
 (0)