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.

refactor(web): rely on QR panel containment (#40352)

yyh9c5d76c29943
diff --git a/oxlint-suppressions.json b/oxlint-suppressions.json
index af293786ef7..28eb5a30017 100644
--- a/oxlint-suppressions.json
+++ b/oxlint-suppressions.json
@@ -1854,14 +1854,6 @@
"count": 1
}
},
- "web/app/components/base/qrcode/index.tsx": {
- "jsx_a11y/click-events-have-key-events": {
- "count": 1
- },
- "jsx_a11y/no-static-element-interactions": {
- "count": 1
- }
- },
"web/app/components/base/search-input/index.stories.tsx": {
"jsx_a11y/label-has-associated-control": {
"count": 3
diff --git a/web/app/components/base/qrcode/__tests__/index.spec.tsx b/web/app/components/base/qrcode/__tests__/index.spec.tsx
index beb6a7d80a1..016c5caf419 100644
--- a/web/app/components/base/qrcode/__tests__/index.spec.tsx
+++ b/web/app/components/base/qrcode/__tests__/index.spec.tsx
@@ -75,6 +75,25 @@ describe('ShareQRCode', () => {
expect(canvas).toBeInTheDocument()
})
+ it('lets panel interactions bubble without closing the panel', async () => {
+ const user = userEvent.setup()
+ const onClick = vi.fn()
+ const { container } = render(<ShareQRCode content={content} />)
+ container.addEventListener('click', onClick)
+
+ await user.click(
+ screen.getByRole('button', {
+ name: 'appOverview.overview.appInfo.qrcode.title',
+ }),
+ )
+ onClick.mockClear()
+
+ await user.click(screen.getByText('appOverview.overview.appInfo.qrcode.scan'))
+
+ expect(onClick).toHaveBeenCalledOnce()
+ expect(screen.getByRole('img')).toBeInTheDocument()
+ })
+
it('calls downloadUrl when clicking download', async () => {
const user = userEvent.setup()
const originalToDataURL = HTMLCanvasElement.prototype.toDataURL
diff --git a/web/app/components/base/qrcode/index.tsx b/web/app/components/base/qrcode/index.tsx
index 5074887e2f9..ac65b51c095 100644
--- a/web/app/components/base/qrcode/index.tsx
+++ b/web/app/components/base/qrcode/index.tsx
@@ -42,10 +42,6 @@ const ShareQRCode = ({ content }: Props) => {
downloadUrl({ url: canvas.toDataURL(), fileName: 'qrcode.png' })
}
- const handlePanelClick = (event: React.MouseEvent) => {
- event.stopPropagation()
- }
-
const tooltipText = t(($) => $[`${prefixEmbedded}`], { ns: 'appOverview' })
/* v8 ignore next -- react-i18next returns a non-empty key/string in configured runtime; empty fallback protects against missing i18n payloads. @preserve */
const safeTooltipText = tooltipText || ''
@@ -65,7 +61,6 @@ const ShareQRCode = ({ content }: Props) => {
<div
ref={qrCodeRef}
className="absolute top-8 -right-8 z-10 flex w-58 flex-col items-center rounded-lg bg-components-panel-bg p-4 shadow-xs"
- onClick={handlePanelClick}
>
<QRCode size={160} value={content} className="mb-2" />
<div className="flex items-center system-xs-regular">