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.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
fix: improve customization settings accessibility (#44492)
Joel30286dac3945
diff --git a/web/app/components/custom/custom-page/__tests__/index.spec.tsx b/web/app/components/custom/custom-page/__tests__/index.spec.tsxindex 1e0da27b397..95252b6f838 100644--- a/web/app/components/custom/custom-page/__tests__/index.spec.tsx+++ b/web/app/components/custom/custom-page/__tests__/index.spec.tsx@@ -66,7 +66,9 @@ describe('CustomPage', () => {render(<CustomPage />)- expect(screen.getByText('custom.upgradeTip.title')).toBeInTheDocument()+ expect(+ screen.getByRole('heading', { level: 4, name: 'custom.upgradeTip.title' }),+ ).toBeInTheDocument()expect(screen.queryByText('custom.customize.contactUs')).not.toBeInTheDocument()await user.click(screen.getByRole('button', { name: 'billing.upgradeBtn.encourageShort' }))diff --git a/web/app/components/custom/custom-page/index.tsx b/web/app/components/custom/custom-page/index.tsxindex cc3aa6cd7ad..07f0781ac8e 100644--- a/web/app/components/custom/custom-page/index.tsx+++ b/web/app/components/custom/custom-page/index.tsx@@ -35,9 +35,9 @@ const CustomPage = () => {{showBillingTip && (<div className="mb-1 flex justify-between rounded-xl bg-linear-to-r from-components-input-border-active-prompt-1 to-components-input-border-active-prompt-2 p-4 pl-6 shadow-lg backdrop-blur-xs"><div className="space-y-1 text-text-primary-on-surface">- <div className="title-xl-semi-bold">+ <h4 className="title-xl-semi-bold">{t(($) => $['upgradeTip.title'], { ns: 'custom' })}- </div>+ </h4><div className="system-sm-regular">{t(($) => $['upgradeTip.des'], { ns: 'custom' })}</div>@@ -53,7 +53,7 @@ const CustomPage = () => {)}<CustomWebAppBrand />{showContact && (- <div className="absolute bottom-0 h-12.5 text-xs leading-12.5 text-text-quaternary">+ <div className="mt-6 pb-4 text-xs leading-5 wrap-anywhere text-text-quaternary">{t(($) => $['customize.prefix'], { ns: 'custom' })}<aclassName="text-text-accent"diff --git a/web/app/components/custom/custom-web-app-brand/__tests__/index.spec.tsx b/web/app/components/custom/custom-web-app-brand/__tests__/index.spec.tsxindex 9033d2fcbe3..ffd582b9b17 100644--- a/web/app/components/custom/custom-web-app-brand/__tests__/index.spec.tsx+++ b/web/app/components/custom/custom-web-app-brand/__tests__/index.spec.tsx@@ -76,6 +76,22 @@ beforeEach(() => {})afterEach(() => toast.dismiss())+it('opens the file chooser from the visible keyboard upload action', async () => {+ const { user } = renderBrand()+ const openChooser = vi.spyOn(uploadInput(), 'click').mockImplementation(() => {})+ await user.tab()+ expect(removalSwitch()).toHaveFocus()+ await user.tab()+ expect(screen.getByRole('button', { name: 'custom.restore' })).toHaveFocus()+ await user.tab()+ const changeButton = screen.getByRole('button', { name: 'custom.change' })+ expect(changeButton).toHaveFocus()+ await user.keyboard('{Enter}')+ expect(openChooser).toHaveBeenCalledOnce()+ expect(changeButton).toHaveFocus()+ openChooser.mockRestore()+})+it('cancels an upload, accepts the same file again, then applies and restores the logo', async () => {const { user } = renderBrand()const file = logoFile()@@ -129,6 +145,13 @@ it('prefers workspace branding over the custom web app logo in both previews', (expectPreviewLogo('https://example.com/workspace.png')})+it('exposes only named actions while preserving the branding preview', () => {+ renderBrand()+ for (const button of screen.getAllByRole('button')) expect(button).toHaveAccessibleName()+ expect(screen.getByRole('button', { name: 'Execute' })).toBeDisabled()+ expectPreviewLogo('https://example.com/logo.png')+})+it.each([{ reason: 'plan restriction', canReplace: false, canManage: true },{ reason: 'missing permission', canReplace: true, canManage: false },@@ -182,23 +205,37 @@ it('rejects an oversized logo before sending an upload', async () => {expect(screen.queryByRole('button', { name: 'custom.apply' })).not.toBeInTheDocument()})-it('shows upload progress and waits for a successful upload before offering Apply', async () => {- const request = createDeferred<Awaited<ReturnType<typeof upload>>>()- upload.mockImplementation((options) => {- options.onprogress?.call(- options.xhr,- new ProgressEvent('progress', { lengthComputable: true, loaded: 50, total: 100 }),- )- return request.promise- })- const { user } = renderBrand()- await user.upload(uploadInput(), logoFile())- expect(screen.getByRole('button', { name: 'custom.uploading' })).toBeDisabled()- expect(screen.queryByRole('button', { name: 'custom.apply' })).not.toBeInTheDocument()- await act(async () => request.resolve({ id: 'new-logo' }))- expect(await screen.findByRole('button', { name: 'custom.apply' })).toBeEnabled()- expect(screen.queryByRole('button', { name: 'custom.uploading' })).not.toBeInTheDocument()-})+it.each([0, 100])(+ 'announces uploading and waits for the response at %s percent',+ async (loaded) => {+ const request = createDeferred<Awaited<ReturnType<typeof upload>>>()+ upload.mockImplementation((options) => {+ options.onprogress?.call(+ options.xhr,+ new ProgressEvent('progress', { lengthComputable: true, loaded, total: 100 }),+ )+ return request.promise+ })+ const { user } = renderBrand()+ const changeButton = screen.getByRole('button', { name: 'custom.change' })+ await user.click(changeButton)+ await user.upload(uploadInput(), logoFile())+ const pendingButton = screen.getByRole('button', { name: 'custom.uploading' })+ expect(pendingButton).toBe(changeButton)+ expect(pendingButton).toHaveAttribute('aria-disabled', 'true')+ expect(screen.getByRole('status')).toHaveTextContent('custom.uploading')+ expect(uploadInput()).toBeDisabled()+ await user.click(pendingButton)+ expect(upload).toHaveBeenCalledOnce()+ expect(screen.queryByRole('button', { name: 'custom.apply' })).not.toBeInTheDocument()+ await act(async () => request.resolve({ id: 'new-logo' }))+ expect(await screen.findByRole('button', { name: 'custom.apply' })).toBeEnabled()+ expect(changeButton).not.toHaveAttribute('aria-disabled', 'true')+ expect(uploadInput()).toBeEnabled()+ expect(screen.getByRole('status')).toHaveTextContent('custom.change')+ expect(screen.queryByRole('button', { name: 'custom.uploading' })).not.toBeInTheDocument()+ },+)it.each([{diff --git a/web/app/components/custom/custom-web-app-brand/components/chat-preview-card.tsx b/web/app/components/custom/custom-web-app-brand/components/chat-preview-card.tsxindex c669e903ab4..429bb57f69b 100644--- a/web/app/components/custom/custom-web-app-brand/components/chat-preview-card.tsx+++ b/web/app/components/custom/custom-web-app-brand/components/chat-preview-card.tsx@@ -1,4 +1,4 @@-import { Button } from '@langgenius/dify-ui/button'+import { buttonVariants } from '@langgenius/dify-ui/button'import { cn } from '@langgenius/dify-ui/cn'import PoweredByBrand from './powered-by-brand'@@ -33,12 +33,15 @@ const ChatPreviewCard = ({</div></div><div className="shrink-0 px-4 py-3">- <Button variant="secondary-accent" className="w-full justify-center">+ <div+ aria-hidden="true"+ className={cn(buttonVariants({ variant: 'secondary-accent' }), 'w-full justify-center')}+ ><span className="i-ri-edit-box-line size-4" /><div className="p-1 opacity-20"><div className="h-2 w-23.5 rounded-xs bg-text-accent-light-mode-only"></div></div>- </Button>+ </div></div><div className="grow px-3 pt-5"><div className="flex h-8 items-center px-3 py-1">@@ -71,9 +74,9 @@ const ChatPreviewCard = ({<div className="mb-1 body-md-regular text-text-primary">Hello! How can I assist you today?</div>- <Button size="small">+ <div aria-hidden="true" className={buttonVariants({ size: 'small' })}><div className="h-2 w-36 rounded-xs bg-text-quaternary opacity-20"></div>- </Button>+ </div></div><div className="flex h-13 w-144.5 items-center rounded-xl border border-components-chat-input-border bg-components-panel-bg-blur pl-3.5 body-lg-regular text-text-placeholder shadow-md backdrop-blur-xs">Talk to Difydiff --git a/web/app/components/custom/custom-web-app-brand/components/workflow-preview-card.tsx b/web/app/components/custom/custom-web-app-brand/components/workflow-preview-card.tsxindex 44b4a2343fc..2a9973cb00f 100644--- a/web/app/components/custom/custom-web-app-brand/components/workflow-preview-card.tsx+++ b/web/app/components/custom/custom-web-app-brand/components/workflow-preview-card.tsx@@ -1,4 +1,4 @@-import { Button } from '@langgenius/dify-ui/button'+import { Button, buttonVariants } from '@langgenius/dify-ui/button'import { cn } from '@langgenius/dify-ui/cn'import PoweredByBrand from './powered-by-brand'@@ -49,9 +49,9 @@ const WorkflowPreviewCard = ({<div className="h-16 w-full rounded-lg bg-components-input-bg-normal"></div></div><div className="flex items-center justify-between px-4 py-3">- <Button size="small">+ <div aria-hidden="true" className={buttonVariants({ size: 'small' })}><div className="h-2 w-10 rounded-xs bg-text-quaternary opacity-20"></div>- </Button>+ </div><Button variant="primary" size="small" disabled><span className="i-ri-play-large-line size-4" /><span>Execute</span>diff --git a/web/app/components/custom/custom-web-app-brand/hooks/use-web-app-brand.ts b/web/app/components/custom/custom-web-app-brand/hooks/use-web-app-brand.tsindex 18f952fbfc5..2b8d06a40c3 100644--- a/web/app/components/custom/custom-web-app-brand/hooks/use-web-app-brand.ts+++ b/web/app/components/custom/custom-web-app-brand/hooks/use-web-app-brand.ts@@ -25,13 +25,13 @@ const useWebAppBrand = () => {const [fileId, setFileId] = useState('')const [imgKey, setImgKey] = useState(() => Date.now())const [uploadProgress, setUploadProgress] = useState(0)+ const [uploading, setUploading] = useState(false)const { data: systemFeatures } = useSuspenseQuery(systemFeaturesQueryOptions())const customConfigQuery = useQuery(consoleQuery.workspaces.customConfig.get.queryOptions())const { data: customConfig } = customConfigQueryconst updateCustomConfigMutation = useMutation(consoleQuery.workspaces.customConfig.post.mutationOptions(),)- const uploading = uploadProgress > 0 && uploadProgress < 100const webappLogo = customConfig?.replace_webapp_logo || ''const webappBrandRemoved = customConfig?.remove_webapp_brand ?? undefinedconst canManageCustomBrand = hasPermission(workspacePermissionKeys, 'customization.manage')@@ -49,13 +49,15 @@ const useWebAppBrand = () => {})}const handleChange = (e: ChangeEvent<HTMLInputElement>) => {- if (uploadDisabled) return+ if (uploadDisabled || uploading) returnconst file = e.target.files?.[0]if (!file) returnif (file.size > MAX_LOGO_FILE_SIZE) {toast.error(t(($) => $['imageUploader.uploadFromComputerLimit'], { ns: 'common', size: 5 }))return}+ setUploadProgress(0)+ setUploading(true)imageUpload({file,@@ -63,6 +65,7 @@ const useWebAppBrand = () => {onSuccessCallback: (res) => {setUploadProgress(100)setFileId(res.id)+ setUploading(false)},onErrorCallback: (error) => {const errorMessage = getImageUploadErrorMessage(@@ -72,6 +75,7 @@ const useWebAppBrand = () => {)toast.error(errorMessage)setUploadProgress(-1)+ setUploading(false)},},false,diff --git a/web/app/components/custom/custom-web-app-brand/index.tsx b/web/app/components/custom/custom-web-app-brand/index.tsxindex 2d23df3d35d..f318ff3fcf1 100644--- a/web/app/components/custom/custom-web-app-brand/index.tsx+++ b/web/app/components/custom/custom-web-app-brand/index.tsx@@ -2,7 +2,7 @@ import { Button } from '@langgenius/dify-ui/button'import { cn } from '@langgenius/dify-ui/cn'import { Separator } from '@langgenius/dify-ui/separator'import { Switch } from '@langgenius/dify-ui/switch'-import { useId } from 'react'+import { useId, useRef } from 'react'import { useTranslation } from 'react-i18next'import ChatPreviewCard from './components/chat-preview-card'import WorkflowPreviewCard from './components/workflow-preview-card'@@ -13,6 +13,8 @@ const ALLOW_FILE_EXTENSIONS = ['svg', 'png']const CustomWebAppBrand = () => {const brandSwitchId = useId()const logoInputId = useId()+ const uploadLabelId = useId()+ const logoInputRef = useRef<HTMLInputElement>(null)const { t } = useTranslation(['appOverview', 'common', 'custom'])const {fileId,@@ -47,11 +49,11 @@ const CustomWebAppBrand = () => {</div><divclassName={cn(- 'flex h-14 items-center justify-between rounded-xl bg-background-section-burn px-4',+ 'flex min-h-14 flex-col items-start gap-3 rounded-xl bg-background-section-burn p-4 sm:flex-row sm:items-center sm:justify-between sm:py-2',webappBrandRemoved && 'opacity-30',)}>- <div>+ <div className="min-w-0 wrap-anywhere"><label htmlFor={logoInputId} className="block system-md-medium text-text-primary">{t(($) => $['webapp.changeLogo'], { ns: 'custom' })}</label>@@ -59,7 +61,7 @@ const CustomWebAppBrand = () => {{t(($) => $['webapp.changeLogoTip'], { ns: 'custom' })}</div></div>- <div className="flex items-center">+ <div className="flex max-w-full flex-wrap items-center gap-2">{!uploadDisabled && webappLogo && !webappBrandRemoved && (<><Button@@ -69,47 +71,41 @@ const CustomWebAppBrand = () => {>{t(($) => $.restore, { ns: 'custom' })}</Button>- <div className="mx-2 h-5 w-px bg-divider-regular"></div>+ <div className="h-5 w-px shrink-0 bg-divider-regular"></div></>)}- {!uploading && (- <Button className="relative mr-2" disabled={uploadDisabled}>- <span className="i-ri-image-add-line size-4" />- {webappLogo || fileId- ? t(($) => $.change, { ns: 'custom' })- : t(($) => $.upload, { ns: 'custom' })}- <input- id={logoInputId}- className={cn(- 'absolute inset-0 block w-full text-[0] opacity-0',- uploadDisabled ? 'cursor-not-allowed' : 'cursor-pointer',- )}- onClick={(e) => ((e.target as HTMLInputElement).value = '')}- type="file"- accept={ALLOW_FILE_EXTENSIONS.map((ext) => `.${ext}`).join(',')}- onChange={handleChange}- disabled={uploadDisabled}- />- </Button>- )}- {uploading && (- <Button className="relative mr-2" disabled={true}>- <span className="i-ri-loader-2-line size-4 animate-spin" />- {t(($) => $.uploading, { ns: 'custom' })}- </Button>- )}+ <Button+ aria-labelledby={uploadLabelId}+ disabled={uploadDisabled}+ loading={uploading}+ onClick={() => logoInputRef.current?.click()}+ >+ {!uploading && <span aria-hidden="true" className="i-ri-image-add-line size-4" />}+ <span id={uploadLabelId} role="status" aria-atomic="true">+ {uploading+ ? t(($) => $.uploading, { ns: 'custom' })+ : webappLogo || fileId+ ? t(($) => $.change, { ns: 'custom' })+ : t(($) => $.upload, { ns: 'custom' })}+ </span>+ </Button>+ <input+ ref={logoInputRef}+ id={logoInputId}+ hidden+ onClick={(e) => ((e.target as HTMLInputElement).value = '')}+ type="file"+ accept={ALLOW_FILE_EXTENSIONS.map((ext) => `.${ext}`).join(',')}+ onChange={handleChange}+ disabled={uploadDisabled || uploading}+ />{fileId && (<>- <Button- className="mr-2"- onClick={handleCancel}- disabled={webappBrandRemoved || !canManageCustomBrand}- >+ <Button onClick={handleCancel} disabled={webappBrandRemoved || !canManageCustomBrand}>{t(($) => $['operation.cancel'], { ns: 'common' })}</Button><Buttonvariant="primary"- className="mr-2"onClick={handleApply}disabled={isCustomConfigUnavailable ||@@ -130,9 +126,9 @@ const CustomWebAppBrand = () => {</div>)}<div className="mt-5 mb-2 flex items-center gap-2">- <div className="shrink-0 system-xs-medium-uppercase text-text-tertiary">+ <h4 className="shrink-0 system-xs-medium-uppercase text-text-tertiary">{t(($) => $['overview.appInfo.preview'], { ns: 'appOverview' })}- </div>+ </h4><Separator decorative variant="gradient" className="my-2 h-[0.5px] grow" /></div><div className="relative mb-2 flex items-center gap-3">diff --git a/web/app/components/header/account-setting/__tests__/settings-modal.spec.tsx b/web/app/components/header/account-setting/__tests__/settings-modal.spec.tsxindex 3245a2a320f..04aa1aae96b 100644--- a/web/app/components/header/account-setting/__tests__/settings-modal.spec.tsx+++ b/web/app/components/header/account-setting/__tests__/settings-modal.spec.tsx@@ -136,6 +136,9 @@ it('opens preferences from the URL control, switches real pages, and closes withawait user.click(screen.getByRole('button', { name: 'Open preferences' }))const dialog = await findSettings()expect(within(dialog).getByText('accountSettings.account.appearanceLabel')).toBeInTheDocument()+ expect(within(dialog).getByRole('button', { current: 'page' })).toHaveAccessibleName(+ 'navigation.settings.preferences',+ )expect(onUrlUpdate.mock.lastCall?.[0]).toMatchObject({options: { history: 'replace', shallow: true },})@@ -176,6 +179,7 @@ it('opens preferences from the URL control, switches real pages, and closes withfor (const { name, tab, content } of destinations) {await user.click(within(dialog).getByRole('button', { name }))expect(await within(dialog).findByText(content)).toBeInTheDocument()+ expect(within(dialog).getByRole('button', { current: 'page' })).toHaveAccessibleName(name)await waitFor(() =>expect(onUrlUpdate.mock.lastCall?.[0].searchParams.get('settings')).toBe(tab),)@@ -267,6 +271,21 @@ it('allows regular members to read billing without management permissions', asyn).not.toBeInTheDocument()})+it('exposes the customization page and preview through heading navigation', async () => {+ renderSettings(TAB.CUSTOM)+ const dialog = await findSettings()+ expect(within(dialog).getByRole('heading', { level: 2 })).toHaveAccessibleName(+ 'navigation.settings.settings',+ )+ expect(within(dialog).getByRole('heading', { level: 3 })).toHaveAccessibleName('custom.custom')+ expect(+ await within(dialog).findByRole('heading', {+ level: 4,+ name: 'appOverview.overview.appInfo.preview',+ }),+ ).toBeInTheDocument()+})+it.each([{reason: 'dataset operators',diff --git a/web/app/components/header/account-setting/index.tsx b/web/app/components/header/account-setting/index.tsxindex 2c728b048fa..a68baaa3a9d 100644--- a/web/app/components/header/account-setting/index.tsx+++ b/web/app/components/header/account-setting/index.tsx@@ -39,7 +39,7 @@ import ResourceAccessTokenPage from './resource-access-token-page'import WorkflowLogArchivesPage from './workflow-log-archives-page'const iconClassName = `- w-4 h-4 mr-2+ size-4 shrink-0 sm:mr-2`type IAccountSettingProps = {@@ -218,8 +218,8 @@ export default function AccountSetting({onClose={onCancelAction}><div className="mx-auto flex h-screen w-full max-w-270 px-4">- <div className="flex w-11 shrink-0 flex-col pr-6 pl-4 sm:w-56">- <div className="mt-6 mb-8 flex h-9.5 items-center px-3 title-2xl-semi-bold whitespace-nowrap text-text-primary">+ <div className="flex w-11 shrink-0 flex-col pr-2 sm:w-56 sm:pr-6 sm:pl-4">+ <div className="invisible mt-6 mb-8 flex h-9.5 items-center px-3 title-2xl-semi-bold whitespace-nowrap text-text-primary sm:visible">{t(($) => $['settings.settings'], { ns: 'navigation' })}</div><div className="w-full">@@ -243,12 +243,13 @@ export default function AccountSetting({type="button"key={item.key}className={cn(- 'mb-0.5 flex h-8 w-full items-center rounded-lg px-3 text-left text-sm focus-visible:ring-2 focus-visible:ring-state-accent-solid focus-visible:outline-hidden',+ 'mb-0.5 flex h-8 w-full items-center justify-center rounded-lg px-2 text-left text-sm focus-visible:ring-2 focus-visible:ring-state-accent-solid focus-visible:outline-hidden sm:justify-start sm:px-3',activeMenu === item.key? 'bg-state-base-active system-sm-semibold text-components-menu-item-text-active': 'system-sm-medium text-components-menu-item-text',)}aria-label={item.name}+ aria-current={activeMenu === item.key ? 'page' : undefined}title={item.name}onClick={() => {onTabChangeAction(item.key)@@ -280,8 +281,10 @@ export default function AccountSetting({>{activeMenu !== ACCOUNT_SETTING_TAB.IP_POLICIES && (<div className="sticky top-0 z-20 mx-8 flex min-h-15 items-end bg-components-panel-bg pt-8 pb-2">- <div className="min-w-0 flex-1 title-2xl-semi-bold text-text-primary">- {activeItem?.title ?? activeItem?.name}+ <div className="min-w-0 flex-1">+ <h3 className="title-2xl-semi-bold text-text-primary">+ {activeItem?.title ?? activeItem?.name}+ </h3>{activeItem?.description && (<div className="mt-1 system-sm-regular wrap-break-word whitespace-normal text-text-tertiary">{activeItem?.description}