Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix(web): hide citation measurement items from assistive tech (#40203)

yyhe7f789f185a6
diff --git a/web/app/components/base/chat/chat/citation/__tests__/index.spec.tsx b/web/app/components/base/chat/chat/citation/__tests__/index.spec.tsx
index 13f8f1fab24..f734db90c13 100644
--- a/web/app/components/base/chat/chat/citation/__tests__/index.spec.tsx
+++ b/web/app/components/base/chat/chat/citation/__tests__/index.spec.tsx
@@ -96,7 +96,9 @@ describe('Citation', () => {
]}
/>,
)
- expect(screen.getAllByTestId('citation-measurement-item')).toHaveLength(2)
+ const measurementItems = screen.getAllByTestId('citation-measurement-item')
+ expect(measurementItems).toHaveLength(2)
+ measurementItems.forEach((item) => expect(item).toHaveAttribute('aria-hidden', 'true'))
})
it('should display the document name inside each measurement item', () => {
diff --git a/web/app/components/base/chat/chat/citation/index.tsx b/web/app/components/base/chat/chat/citation/index.tsx
index 2ae793f9a52..9e57636bdf5 100644
--- a/web/app/components/base/chat/chat/citation/index.tsx
+++ b/web/app/components/base/chat/chat/citation/index.tsx
@@ -86,6 +86,7 @@ const Citation: FC<CitationProps> = ({
{resources.map((res, index) => (
<div
key={res.documentId}
+ aria-hidden
data-testid="citation-measurement-item"
className="absolute top-0 left-0 -z-10 mr-1 mb-1 h-7 w-auto max-w-60 pr-2 pl-7 text-xs whitespace-nowrap opacity-0"
ref={(ele: HTMLDivElement | null) => {