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 external API modal close (#40313)

yyh72fad399135b
diff --git a/web/app/components/datasets/external-api/external-api-modal/__tests__/index.spec.tsx b/web/app/components/datasets/external-api/external-api-modal/__tests__/index.spec.tsx
index f0942a2cbcc..da5adb3caba 100644
--- a/web/app/components/datasets/external-api/external-api-modal/__tests__/index.spec.tsx
+++ b/web/app/components/datasets/external-api/external-api-modal/__tests__/index.spec.tsx
@@ -74,9 +74,7 @@ describe('AddExternalAPIModal', () => {
it('should render close button', () => {
render(<AddExternalAPIModal {...defaultProps} />)
- // Close button is rendered in a portal
- const closeButton = document.body.querySelector('.action-btn')
- expect(closeButton)!.toBeInTheDocument()
+ expect(screen.getByRole('button', { name: 'common.operation.close' })).toBeInTheDocument()
})
})
@@ -388,9 +386,7 @@ describe('AddExternalAPIModal', () => {
const onCancel = vi.fn()
render(<AddExternalAPIModal {...defaultProps} onCancel={onCancel} />)
- // Close button is rendered in a portal
- const closeButton = document.body.querySelector('.action-btn')!
- fireEvent.click(closeButton)
+ fireEvent.click(screen.getByRole('button', { name: 'common.operation.close' }))
expect(onCancel).toHaveBeenCalledTimes(1)
})
diff --git a/web/app/components/datasets/external-api/external-api-modal/index.tsx b/web/app/components/datasets/external-api/external-api-modal/index.tsx
index 7cad1fa90e6..d012ce49a01 100644
--- a/web/app/components/datasets/external-api/external-api-modal/index.tsx
+++ b/web/app/components/datasets/external-api/external-api-modal/index.tsx
@@ -184,8 +184,12 @@ const AddExternalAPIModal: FC<AddExternalAPIModalProps> = ({
</div>
)}
</div>
- <ActionButton className="absolute top-5 right-5" onClick={onCancel}>
- <RiCloseLine className="h-4.5 w-4.5 shrink-0 text-text-tertiary" />
+ <ActionButton
+ aria-label={t(($) => $['operation.close'], { ns: 'common' })}
+ className="absolute top-5 right-5"
+ onClick={onCancel}
+ >
+ <RiCloseLine aria-hidden className="h-4.5 w-4.5 shrink-0 text-text-tertiary" />
</ActionButton>
<Form
value={formData}