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): use a button for the webapp fallback action (#40197)

yyh4edaecc04d34
diff --git a/oxlint-suppressions.json b/oxlint-suppressions.json
index 34238581503..d3173aecf3b 100644
--- a/oxlint-suppressions.json
+++ b/oxlint-suppressions.json
@@ -162,14 +162,6 @@
"count": 2
}
},
- "web/app/(shareLayout)/webapp-signin/page.tsx": {
- "jsx_a11y/click-events-have-key-events": {
- "count": 1
- },
- "jsx_a11y/no-static-element-interactions": {
- "count": 1
- }
- },
"web/app/account/(commonLayout)/account-page/email-change-modal.tsx": {
"jsx_a11y/click-events-have-key-events": {
"count": 3
diff --git a/web/app/(shareLayout)/webapp-signin/__tests__/page.spec.tsx b/web/app/(shareLayout)/webapp-signin/__tests__/page.spec.tsx
index d791330d78d..f4dce56745c 100644
--- a/web/app/(shareLayout)/webapp-signin/__tests__/page.spec.tsx
+++ b/web/app/(shareLayout)/webapp-signin/__tests__/page.spec.tsx
@@ -1,5 +1,7 @@
-import { waitFor } from '@testing-library/react'
+import { screen, waitFor } from '@testing-library/react'
+import userEvent from '@testing-library/user-event'
import { AccessMode } from '@/models/access-control'
+import { webAppLogout } from '@/service/webapp-auth'
import { renderWithConsoleQuery } from '@/test/console/query-data'
import WebSSOForm from '../page'
@@ -43,4 +45,22 @@ describe('WebSSOForm redirect security', () => {
expect(navigationMocks.replace).toHaveBeenCalledWith('/')
})
})
+
+ it('should expose the unavailable-state fallback as a button', async () => {
+ const user = userEvent.setup()
+ navigationMocks.searchParams = new URLSearchParams({
+ redirect_url: encodeURIComponent('/chatbot/share-app'),
+ })
+
+ renderWithConsoleQuery(<WebSSOForm />, {
+ systemFeatures: { webapp_auth: { enabled: true } },
+ })
+
+ await user.click(await screen.findByRole('button', { name: 'share.login.backToHome' }))
+
+ expect(webAppLogout).toHaveBeenCalledWith('share-app')
+ expect(navigationMocks.replace).toHaveBeenCalledWith(
+ '/webapp-signin?redirect_url=%2Fchatbot%2Fshare-app',
+ )
+ })
})
diff --git a/web/app/(shareLayout)/webapp-signin/page.tsx b/web/app/(shareLayout)/webapp-signin/page.tsx
index ac923ebc38f..8aa627fc621 100644
--- a/web/app/(shareLayout)/webapp-signin/page.tsx
+++ b/web/app/(shareLayout)/webapp-signin/page.tsx
@@ -86,9 +86,13 @@ function WebSSOForm() {
return (
<div className="flex h-full flex-col items-center justify-center gap-y-4">
<AppUnavailable className="size-auto" isUnknownReason={true} />
- <span className="cursor-pointer system-sm-regular text-text-tertiary" onClick={backToHome}>
+ <button
+ type="button"
+ className="cursor-pointer appearance-none system-sm-regular text-text-tertiary focus-visible:ring-2 focus-visible:ring-state-accent-solid focus-visible:outline-hidden"
+ onClick={backToHome}
+ >
{t(($) => $['login.backToHome'], { ns: 'share' })}
- </span>
+ </button>
</div>
)
}