Skip to content

Commit 5c4510d

Browse files
committed
fix(react): file tree's files to indicate selected state
1 parent d4d109d commit 5c4510d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/components/react/src/core/FileTree.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ function File({ file: { depth, name }, onClick, selected }: FileProps) {
150150
'text-tk-elements-fileTree-file-iconColorSelected': selected,
151151
})}
152152
onClick={onClick}
153+
aria-pressed={selected}
153154
>
154155
{name}
155156
</NodeButton>
@@ -162,14 +163,16 @@ interface ButtonProps {
162163
children: ReactNode;
163164
className?: string;
164165
onClick?: () => void;
166+
'aria-pressed'?: boolean;
165167
}
166168

167-
function NodeButton({ depth, iconClasses, onClick, className, children }: ButtonProps) {
169+
function NodeButton({ depth, iconClasses, onClick, className, 'aria-pressed': ariaPressed, children }: ButtonProps) {
168170
return (
169171
<button
170172
className={`flex items-center gap-2 w-full pr-2 border-2 border-transparent text-faded ${className ?? ''}`}
171173
style={{ paddingLeft: `${12 + depth * NODE_PADDING_LEFT}px` }}
172174
onClick={() => onClick?.()}
175+
aria-pressed={ariaPressed === true ? 'true' : undefined}
173176
>
174177
<div className={classNames('scale-120 shrink-0', iconClasses)}></div>
175178
<span>{children}</span>

0 commit comments

Comments
 (0)