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): name annotation reply actions (#40270)

yyhd94c4415af79
diff --git a/web/app/components/base/features/new-feature-panel/annotation-reply/__tests__/annotation-ctrl-button.spec.tsx b/web/app/components/base/features/new-feature-panel/annotation-reply/__tests__/annotation-ctrl-button.spec.tsx
index 0a6a06d250c..0794abbba6d 100644
--- a/web/app/components/base/features/new-feature-panel/annotation-reply/__tests__/annotation-ctrl-button.spec.tsx
+++ b/web/app/components/base/features/new-feature-panel/annotation-reply/__tests__/annotation-ctrl-button.spec.tsx
@@ -60,7 +60,9 @@ describe('AnnotationCtrlButton', () => {
/>,
)
- expect(screen.getByRole('button')).toBeInTheDocument()
+ expect(
+ screen.getByRole('button', { name: 'appDebug.feature.annotation.edit' }),
+ ).toBeInTheDocument()
})
it('should call onEdit when edit button is clicked', () => {
@@ -76,7 +78,7 @@ describe('AnnotationCtrlButton', () => {
/>,
)
- fireEvent.click(screen.getByRole('button'))
+ fireEvent.click(screen.getByRole('button', { name: 'appDebug.feature.annotation.edit' }))
expect(onEdit).toHaveBeenCalled()
})
@@ -93,7 +95,9 @@ describe('AnnotationCtrlButton', () => {
/>,
)
- expect(screen.getByRole('button')).toBeInTheDocument()
+ expect(
+ screen.getByRole('button', { name: 'appDebug.feature.annotation.add' }),
+ ).toBeInTheDocument()
})
it('should not render any button when not cached and no answer', () => {
@@ -125,7 +129,7 @@ describe('AnnotationCtrlButton', () => {
/>,
)
- fireEvent.click(screen.getByRole('button'))
+ fireEvent.click(screen.getByRole('button', { name: 'appDebug.feature.annotation.add' }))
await waitFor(() => {
expect(mockAddAnnotation).toHaveBeenCalledWith('test-app', {
@@ -151,7 +155,7 @@ describe('AnnotationCtrlButton', () => {
/>,
)
- fireEvent.click(screen.getByRole('button'))
+ fireEvent.click(screen.getByRole('button', { name: 'appDebug.feature.annotation.add' }))
expect(mockSetShowAnnotationFullModal).toHaveBeenCalled()
expect(mockAddAnnotation).not.toHaveBeenCalled()
@@ -176,7 +180,7 @@ describe('AnnotationCtrlButton', () => {
/>,
)
- fireEvent.click(screen.getByRole('button'))
+ fireEvent.click(screen.getByRole('button', { name: 'appDebug.feature.annotation.add' }))
await waitFor(() => {
expect(onAdded).toHaveBeenCalledWith('annotation-2', '')
diff --git a/web/app/components/base/features/new-feature-panel/annotation-reply/annotation-ctrl-button.tsx b/web/app/components/base/features/new-feature-panel/annotation-reply/annotation-ctrl-button.tsx
index ccf136ec7d8..44ea6a33242 100644
--- a/web/app/components/base/features/new-feature-panel/annotation-reply/annotation-ctrl-button.tsx
+++ b/web/app/components/base/features/new-feature-panel/annotation-reply/annotation-ctrl-button.tsx
@@ -52,8 +52,11 @@ const AnnotationCtrlButton: FC<Props> = ({
<Tooltip>
<TooltipTrigger
render={
- <ActionButton onClick={onEdit}>
- <RiEditLine className="size-4" />
+ <ActionButton
+ aria-label={t(($) => $['feature.annotation.edit'], { ns: 'appDebug' })}
+ onClick={onEdit}
+ >
+ <RiEditLine aria-hidden className="size-4" />
</ActionButton>
}
/>
@@ -66,8 +69,11 @@ const AnnotationCtrlButton: FC<Props> = ({
<Tooltip>
<TooltipTrigger
render={
- <ActionButton onClick={handleAdd}>
- <RiFileEditLine className="size-4" />
+ <ActionButton
+ aria-label={t(($) => $['feature.annotation.add'], { ns: 'appDebug' })}
+ onClick={handleAdd}
+ >
+ <RiFileEditLine aria-hidden className="size-4" />
</ActionButton>
}
/>