mirror of
https://github.com/langgenius/dify.git
synced 2026-02-13 07:01:23 -05:00
fix(a11y): improve accessibility for artifacts tree
Add aria-label, aria-expanded attributes and focus-visible styles for folder buttons. Hide loading skeleton from assistive tech.
This commit is contained in:
@@ -81,7 +81,7 @@ const ArtifactsSection: FC<ArtifactsSectionProps> = ({ className }) => {
|
||||
<div className="flex flex-col gap-px">
|
||||
{isLoading
|
||||
? (
|
||||
<div className="px-2.5 py-3">
|
||||
<div className="px-2.5 py-3" aria-hidden="true">
|
||||
<div className="h-4 w-full animate-pulse rounded bg-components-panel-bg" />
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -45,6 +45,8 @@ const ArtifactsTreeNode: FC<ArtifactsTreeNodeProps> = ({
|
||||
<div
|
||||
role={isFolder ? 'button' : undefined}
|
||||
tabIndex={isFolder ? 0 : undefined}
|
||||
aria-label={isFolder ? `${node.name} folder` : undefined}
|
||||
aria-expanded={isFolder ? isExpanded : undefined}
|
||||
onClick={handleToggle}
|
||||
onKeyDown={isFolder
|
||||
? (e) => {
|
||||
@@ -54,7 +56,7 @@ const ArtifactsTreeNode: FC<ArtifactsTreeNodeProps> = ({
|
||||
: undefined}
|
||||
className={cn(
|
||||
'group flex items-center gap-0 rounded-md py-0.5 pr-1.5',
|
||||
isFolder && 'cursor-pointer hover:bg-state-base-hover',
|
||||
isFolder && 'cursor-pointer hover:bg-state-base-hover focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-components-input-border-active',
|
||||
!isFolder && 'hover:bg-state-base-hover',
|
||||
)}
|
||||
style={{ paddingLeft: `${8 + depth * 20}px` }}
|
||||
|
||||
Reference in New Issue
Block a user