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(web): enforce focus style ownership and simplify invite recipients (#44504)
yyh972924bb829a
diff --git a/packages/tooling/lint.config.ts b/packages/tooling/lint.config.tsindex a79b1730a3f..441de1c5bae 100644--- a/packages/tooling/lint.config.ts+++ b/packages/tooling/lint.config.ts@@ -246,13 +246,50 @@ const storageRestrictedProperties = [},] satisfies NonNullable<OxlintConfig['rules']>[string]+const focusIndicatorOverrides = [+ 'ring-w',+ 'ring-color',+ 'ring-offset-w',+ 'ring-offset-color',+ 'outline-w',+ 'outline-color',+ 'outline-style',+ 'outline-offset',+ 'focus:inset-ring-*',+ 'focus*:inset-ring-*',+ '*:focus:inset-ring-*',+ '*:focus*:inset-ring-*',+]+export const stylingContractRules = {'shadcn/no-restyle': ['error',{- componentImports: ['^@langgenius/dify-ui/(tooltip|infotip|dialog|alert-dialog)$'],+ componentImports: ['^@langgenius/dify-ui/'],allow: ['*'],contracts: [+ {+ pattern: '^(ScrollArea|ScrollAreaViewport)$',+ allow: ['*'],+ deny: [...focusIndicatorOverrides, 'ring-*', 'inset-ring-*'],+ message:+ '"{{className}}" duplicates or overrides the ScrollArea focus indicator. Put focus, keyboard events and accessible names on ScrollAreaViewport; ScrollArea paints the indicator above its contents. Do not add another ring or outline to either part.',+ },+ {+ pattern: '^(Button|IconButton)$',+ allow: ['*'],+ deny: focusIndicatorOverrides,+ message:+ '"{{className}}" duplicates or overrides the {{component}} focus indicator. Keep its width, color and primary-button inner separator. Callers may use ring-inset to avoid clipping; a different focus owner or a box-shadow animation requires a documented local exception.',+ },+ {+ pattern:+ '^(Input|Textarea|InputGroup|InputGroupInput|NumberFieldGroup|NumberFieldInput|ComboboxInputGroup|ComboboxInput|AutocompleteInputGroup|AutocompleteInput|DropdownMenuInputGroup|DropdownMenuInput)$',+ allow: ['*'],+ deny: focusIndicatorOverrides,+ message:+ '"{{className}}" duplicates or overrides the {{component}} focus indicator. The visible field owns focus; an input inside a styled group stays bare. Use ring-inset for clipped edges. A custom composite that moves the indicator needs a documented local exception.',+ },{pattern: '^TooltipContent$',allow: ['flex', 'items-center', 'gap-1', 'w-*', 'max-w-*'],@@ -320,6 +357,16 @@ export const stylingContractRules = {],} satisfies NonNullable<OxlintConfig['rules']>+export const storyStylingContractRules = {+ 'shadcn/no-restyle': [+ 'error',+ {+ ...stylingContractRules['shadcn/no-restyle'][1],+ componentImports: ['^@langgenius/dify-ui/', '^\\.{1,2}(?:/|$)'],+ },+ ],+} satisfies NonNullable<OxlintConfig['rules']>+const tailwindCanonicalClassesOverride = {files: ['web/**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}',@@ -1084,6 +1131,10 @@ export const lintConfig = {files: ['web/**/*.{jsx,tsx}'],rules: stylingContractRules,},+ {+ files: ['packages/dify-ui/**/*.stories.{jsx,tsx}'],+ rules: storyStylingContractRules,+ },{files: ['web/**/*.stories.{js,cjs,mjs,jsx,ts,tsx}', 'web/**/*.story.{js,cjs,mjs,jsx,ts,tsx}'],rules: {diff --git a/packages/tooling/plugins/eslint/hint-content.test.ts b/packages/tooling/plugins/eslint/hint-content.test.tsindex 65ec1d4ca2b..0744aff54b2 100644--- a/packages/tooling/plugins/eslint/hint-content.test.ts+++ b/packages/tooling/plugins/eslint/hint-content.test.ts@@ -4,9 +4,9 @@ import { createRequire } from 'node:module'import { tmpdir } from 'node:os'import { dirname, join } from 'node:path'import { expect, it } from 'vite-plus/test'-import { stylingContractRules } from '../../lint.config'+import { storyStylingContractRules, stylingContractRules } from '../../lint.config'-function lintFixture(source: string) {+function lintFixture(source: string, rules = stylingContractRules) {const require = createRequire(import.meta.url)const viteRequire = createRequire(require.resolve('vite-plus/package.json'))const oxlintBin = join(dirname(dirname(viteRequire.resolve('oxlint'))), 'bin', 'oxlint')@@ -17,7 +17,7 @@ function lintFixture(source: string) {JSON.stringify({categories: { correctness: 'off' },jsPlugins: [require.resolve('@shadcn/lint')],- rules: stylingContractRules,+ rules,}),)writeFileSync(join(directory, 'fixture.tsx'), source)@@ -250,3 +250,88 @@ it('allows disabling dialog transitions without allowing surface or animation re])expect(diagnostics.some(({ message }) => message.includes(`"${className}"`))).toBe(true)})++it('keeps focus styling owned by scroll areas, buttons and visible input surfaces', () => {+ const diagnostics = lintFixture(`+ import { ScrollArea, ScrollAreaViewport as Viewport } from '@langgenius/dify-ui/scroll-area'+ import { Button } from '@langgenius/dify-ui/button'+ import { IconButton } from '@langgenius/dify-ui/icon-button'+ import { Input } from '@langgenius/dify-ui/input'+ import { InputGroup, InputGroupInput } from '@langgenius/dify-ui/input-group'+ import { Textarea } from '@langgenius/dify-ui/textarea'+ import { DropdownMenuTrigger } from '@langgenius/dify-ui/dropdown-menu'+ const examples = <>+ <ScrollArea className="rounded-lg ring-2" />+ <Viewport className="focus-visible:ring-2 dark:focus-visible:ring-red-500! outline-hidden focus-visible:inset-ring-2" />+ <Button className="focus-visible:ring-0 focus-visible:inset-ring-0" />+ <DropdownMenuTrigger render={<IconButton aria-label="Open" />} className="focus-visible:outline-2" />+ <Input className="focus:ring-0" />+ <InputGroup className="has-[>input:focus]:ring-2" />+ <InputGroupInput className="focus-visible:ring-2" />+ <Textarea className="focus:outline-none" />+ </>+ `)+ expect(diagnostics).toHaveLength(12)+ for (const component of [+ 'ScrollArea',+ 'ScrollAreaViewport',+ 'Button',+ 'IconButton',+ 'Input',+ 'InputGroup',+ 'InputGroupInput',+ 'Textarea',+ ])+ expect(diagnostics.some(({ message }) => message.includes(component))).toBe(true)+})++it('allows focus placement, state visibility and decoration without adding an indicator', () => {+ const diagnostics = lintFixture(`+ import { ScrollArea, ScrollAreaViewport } from '@langgenius/dify-ui/scroll-area'+ import { Button } from '@langgenius/dify-ui/button'+ import { IconButton } from '@langgenius/dify-ui/icon-button'+ import { Input } from '@langgenius/dify-ui/input'+ import { InputGroup, InputGroupInput } from '@langgenius/dify-ui/input-group'+ import { TooltipTrigger } from '@langgenius/dify-ui/tooltip'+ const examples = <>+ <ScrollArea className="min-h-0 flex-1 rounded-lg overflow-hidden" />+ <ScrollAreaViewport className="overscroll-contain" />+ <Button className="w-full focus-visible:ring-inset inset-ring-1 inset-ring-transparent focus-visible:shadow-sm" />+ <IconButton aria-label="Open" className="opacity-0 focus-visible:opacity-100 focus-visible:z-1 data-popup-open:bg-state-base-hover" />+ <Input className="ring-inset" />+ <InputGroup className="max-w-80" ><InputGroupInput className="px-0" /></InputGroup>+ <TooltipTrigger className="focus-visible:ring-2" />+ <button className="focus-visible:ring-2" />+ </>+ `)+ expect(diagnostics).toEqual([])+})++it('rejects nested focus variants while keeping relative feature imports outside the web contract', () => {+ const diagnostics = lintFixture(`+ import { Button as Action } from '@langgenius/dify-ui/button'+ import { Input } from './feature'+ const examples = <>+ <Action className="focus-visible:hover:inset-ring-0 dark:focus-within:inset-ring-red-500! focus:hover:inset-ring-2" />+ <Input className="focus:ring-0" />+ </>+ `)+ expect(diagnostics).toHaveLength(3)+})++it('enforces the same contracts for relative imports in design system stories', () => {+ const diagnostics = lintFixture(+ `+ import { Button as Action } from '.'+ import { Input } from '../input'+ import { ScrollAreaViewport } from '../scroll-area'+ const examples = <>+ <Action className="focus-visible:ring-0" />+ <Input className="focus:outline-hidden" />+ <ScrollAreaViewport className="focus-visible:ring-2" />+ </>+ `,+ storyStylingContractRules,+ )+ expect(diagnostics).toHaveLength(3)+})diff --git a/web/app/components/base/prompt-editor/plugins/hitl-input-block/pre-populate.tsx b/web/app/components/base/prompt-editor/plugins/hitl-input-block/pre-populate.tsxindex 4f916204d95..8c6acef2f55 100644--- a/web/app/components/base/prompt-editor/plugins/hitl-input-block/pre-populate.tsx+++ b/web/app/components/base/prompt-editor/plugins/hitl-input-block/pre-populate.tsx@@ -125,6 +125,7 @@ const PrePopulate: FC<Props> = ({<Textareaaria-label={t(($) => $[`${i18nPrefix}.staticContent`], { ns: 'workflowHumanInput' })}value={value || ''}+ // oxlint-disable-next-line shadcn/no-restyle -- The enclosing pre-population surface paints the focus ring around the textarea and type switch.className="h-10.75 min-h-10.75 rounded-none border-none bg-transparent px-3 hover:bg-transparent focus:bg-transparent focus:ring-0"onValueChange={(value) => onValueChange?.(value)}onFocus={() => {diff --git a/web/app/components/datasets/documents/detail/completed/common/chunk-content.tsx b/web/app/components/datasets/documents/detail/completed/common/chunk-content.tsxindex ace2f36547e..f33bd7f6b1c 100644--- a/web/app/components/datasets/documents/detail/completed/common/chunk-content.tsx+++ b/web/app/components/datasets/documents/detail/completed/common/chunk-content.tsx@@ -53,7 +53,7 @@ const AutoResizeTextArea: FC<IAutoResizeTextAreaProps> = React.memo(<Textarearef={textareaRef}className={cn(- 'min-h-0 resize-none rounded-none border-none bg-transparent p-0 hover:border-none hover:bg-transparent focus:border-none focus:bg-transparent focus:shadow-none focus-visible:ring-2 focus-visible:ring-state-accent-solid focus-visible:ring-inset disabled:bg-transparent disabled:text-text-secondary disabled:hover:bg-transparent',+ 'min-h-0 resize-none rounded-none border-none bg-transparent p-0 hover:border-none hover:bg-transparent focus:border-none focus:bg-transparent focus-visible:ring-inset disabled:bg-transparent disabled:text-text-secondary disabled:hover:bg-transparent',className,)}style={{@@ -170,7 +170,7 @@ const ChunkContent: FC<IChunkContentProps> = ({return (<Textarea- className="h-full min-h-0 w-full resize-none rounded-none border-none bg-transparent p-0 pb-6 body-md-regular tracking-[-0.07px] text-text-secondary caret-[#295EFF] hover:border-none hover:bg-transparent focus:border-none focus:bg-transparent focus:shadow-none focus-visible:ring-2 focus-visible:ring-state-accent-solid focus-visible:ring-inset disabled:bg-transparent disabled:text-text-secondary disabled:hover:bg-transparent"+ className="h-full min-h-0 w-full resize-none rounded-none border-none bg-transparent p-0 pb-6 body-md-regular tracking-[-0.07px] text-text-secondary caret-[#295EFF] hover:border-none hover:bg-transparent focus:border-none focus:bg-transparent focus-visible:ring-inset disabled:bg-transparent disabled:text-text-secondary disabled:hover:bg-transparent"value={question}aria-label={t(($) => $['segment.contentPlaceholder'], { ns: 'datasetDocuments' }) || ''}placeholder={t(($) => $['segment.contentPlaceholder'], { ns: 'datasetDocuments' }) || ''}diff --git a/web/app/components/datasets/documents/detail/completed/common/summary-text.tsx b/web/app/components/datasets/documents/detail/completed/common/summary-text.tsxindex 68cf9ac6dc6..0e90b67521f 100644--- a/web/app/components/datasets/documents/detail/completed/common/summary-text.tsx+++ b/web/app/components/datasets/documents/detail/completed/common/summary-text.tsx@@ -18,7 +18,7 @@ const SummaryText = ({ value, onChange, disabled }: SummaryTextProps) => {</div><Textareaaria-labelledby={labelId}- className="field-sizing-content min-h-6 w-full resize-none rounded-none border-none bg-transparent p-0 body-sm-regular leading-6 text-text-secondary hover:border-none hover:bg-transparent focus:border-none focus:bg-transparent focus:shadow-none focus-visible:ring-2 focus-visible:ring-state-accent-solid focus-visible:ring-inset disabled:bg-transparent disabled:text-text-secondary disabled:hover:bg-transparent"+ className="field-sizing-content min-h-6 w-full resize-none rounded-none border-none bg-transparent p-0 body-sm-regular leading-6 text-text-secondary hover:border-none hover:bg-transparent focus:border-none focus:bg-transparent focus-visible:ring-inset disabled:bg-transparent disabled:text-text-secondary disabled:hover:bg-transparent"placeholder={t(($) => $['segment.summaryPlaceholder'], { ns: 'datasetDocuments' })}rows={1}value={value ?? ''}diff --git a/web/app/components/goto-anything/index.tsx b/web/app/components/goto-anything/index.tsxindex c8b8f174a90..c417d7c3ac2 100644--- a/web/app/components/goto-anything/index.tsx+++ b/web/app/components/goto-anything/index.tsx@@ -470,6 +470,7 @@ export function GotoAnything() {><AutocompleteInputGroupsize="medium"+ // oxlint-disable-next-line shadcn/no-restyle -- The inline command palette keeps focus in search and indicates navigation on the active descendant.className="h-auto shrink-0 gap-3 rounded-none border-0 bg-components-panel-bg-blur px-4 py-3 has-[input:focus]:ring-0"><span aria-hidden className="i-ri-search-line size-4 text-text-quaternary" />diff --git a/web/app/components/header/account-setting/members-page/invite-modal/email-recipients-field.tsx b/web/app/components/header/account-setting/members-page/invite-modal/email-recipients-field.tsxindex 9e3b58b182c..489f5c62525 100644--- a/web/app/components/header/account-setting/members-page/invite-modal/email-recipients-field.tsx+++ b/web/app/components/header/account-setting/members-page/invite-modal/email-recipients-field.tsx@@ -4,7 +4,7 @@ import type { KeyboardEvent } from 'react'import type { EmailRecipient } from './email-recipients'import { cn } from '@langgenius/dify-ui/cn'import { Field, FieldDescription, FieldError, FieldLabel } from '@langgenius/dify-ui/field'-import { Input } from '@langgenius/dify-ui/input'+import { InputGroup, InputGroupInput } from '@langgenius/dify-ui/input-group'import { useEffect, useRef, useState } from 'react'import { useTranslation } from 'react-i18next'import { hasEmailDelimiter, mergeEmailRecipients } from './email-recipients'@@ -171,15 +171,9 @@ export function EmailRecipientsField({</span>)}</div>- <div- className={cn(- 'flex max-h-24 min-h-10 flex-wrap content-start items-center gap-1 overflow-y-auto rounded-lg border border-transparent bg-components-input-bg-normal px-2 py-1.5 transition-[background-color,border-color,box-shadow]',- 'hover:border-components-input-border-hover hover:bg-components-input-bg-hover',- 'focus-within:bg-components-input-bg-active has-[input:focus]:border-transparent has-[input:focus]:ring-2 has-[input:focus]:ring-state-accent-solid',- 'group-data-invalid/field:border-components-input-border-destructive group-data-invalid/field:bg-components-input-bg-destructive',- disabled &&- 'cursor-not-allowed bg-components-input-bg-disabled hover:border-transparent hover:bg-components-input-bg-disabled',- )}+ <InputGroup+ // oxlint-disable-next-line shadcn/no-restyle -- Recipient chips keep the shared field indicator while showing their own navigation highlight.+ className="max-h-24 flex-wrap content-start gap-1 overflow-y-auto px-2 py-0.75 focus-within:ring-2 focus-within:ring-state-accent-solid">{recipients.length > 0 && (<ul@@ -194,7 +188,7 @@ export function EmailRecipientsField({key={value}className={cn('flex h-6 max-w-full items-center gap-1 rounded-md bg-components-badge-bg-gray-soft px-2 system-xs-medium text-text-secondary outline-hidden',- 'focus-within:inset-ring-1 focus-within:inset-ring-components-input-border-active',+ 'focus-within:ring-1 focus-within:ring-state-accent-solid',!isValid && 'bg-components-badge-bg-red-soft text-text-destructive',)}>@@ -247,7 +241,7 @@ export function EmailRecipientsField({})}</ul>)}- <Input+ <InputGroupInputref={internalInputRef}type="text"disabled={disabled}@@ -260,10 +254,7 @@ export function EmailRecipientsField({: ''}value={draft}- className={cn(- 'h-6 w-0 flex-1 rounded-none border-0 bg-transparent p-0 shadow-none hover:border-transparent hover:bg-transparent focus:border-transparent focus:bg-transparent focus:ring-0 disabled:bg-transparent disabled:hover:bg-transparent enabled:data-invalid:border-transparent enabled:data-invalid:bg-transparent',- recipients.length > 0 ? 'min-w-12' : 'min-w-40',- )}+ className={cn('h-6 p-0', recipients.length > 0 ? 'min-w-12' : 'min-w-40')}onChange={(event) => {updateDraft(event.target.value)setDraftTouched(false)@@ -308,7 +299,7 @@ export function EmailRecipientsField({setDraftTouched(false)}}/>- </div>+ </InputGroup>{fieldError ? (<FieldError match>{fieldError}</FieldError>) : (diff --git a/web/app/components/main-nav/components/help-menu.tsx b/web/app/components/main-nav/components/help-menu.tsxindex 8960a1d13e8..cf473c165c0 100644--- a/web/app/components/main-nav/components/help-menu.tsx+++ b/web/app/components/main-nav/components/help-menu.tsx@@ -158,7 +158,7 @@ const HelpMenu = ({ triggerIcon, triggerClassName, triggerRef, triggerSize }: He<DropdownMenuTriggerref={triggerRef}data-learn-dify-help-target- // The recovery pulse animates box-shadow, so focus is drawn with an outline instead of the ring.+ // oxlint-disable-next-line shadcn/no-restyle -- The recovery pulse animates box-shadow, so an outline replaces the ring.className="focus-visible:ring-0 focus-visible:outline-2 focus-visible:outline-offset-0 focus-visible:outline-state-accent-solid focus-visible:outline-solid"render={<IconButtondiff --git a/web/app/components/main-nav/components/web-apps-section.tsx b/web/app/components/main-nav/components/web-apps-section.tsxindex 12540c751df..47c486dd58f 100644--- a/web/app/components/main-nav/components/web-apps-section.tsx+++ b/web/app/components/main-nav/components/web-apps-section.tsx@@ -232,7 +232,7 @@ const WebAppsSectionContent = () => {aria-busy={installedAppsQuery.isFetching}aria-labelledby={sectionLabelId}style={{ overflowX: 'hidden' }}- className="overscroll-contain focus-visible:ring-2 focus-visible:ring-state-accent-solid focus-visible:ring-inset"+ className="overscroll-contain"role="navigation"><ScrollAreaContent style={{ minWidth: 0 }} className="w-full max-w-full px-2">diff --git a/web/app/components/tools/mcp/detail/content.tsx b/web/app/components/tools/mcp/detail/content.tsxindex 7a186901d8f..8ac1a27ecb8 100644--- a/web/app/components/tools/mcp/detail/content.tsx+++ b/web/app/components/tools/mcp/detail/content.tsx@@ -150,7 +150,7 @@ const MCPDetailContent: FC<Props> = ({type="button"variant="ghost"size="small"- className="h-auto shrink-0 cursor-pointer rounded bg-transparent p-0 text-left system-xs-regular text-text-secondary hover:bg-transparent focus-visible:ring-2 focus-visible:ring-state-accent-solid"+ className="h-auto shrink-0 cursor-pointer rounded bg-transparent p-0 text-left system-xs-regular text-text-secondary hover:bg-transparent"onClick={() => copy(detail.server_identifier || '')}>{detail.server_identifier}diff --git a/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/condition-list/condition-string.tsx b/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/condition-list/condition-string.tsxindex e83e9226305..fb6f1fb13ff 100644--- a/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/condition-list/condition-string.tsx+++ b/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/condition-list/condition-string.tsx@@ -64,7 +64,7 @@ const ConditionString = ({)}{valueMethod === 'constant' && (<Input- className="border-none bg-transparent hover:bg-transparent focus:bg-transparent focus:shadow-none focus-visible:ring-2 focus-visible:ring-state-accent-solid"+ className="border-none bg-transparent hover:bg-transparent focus:bg-transparent"value={value}onValueChange={onChange}aria-label={t(($) => $['nodes.knowledgeRetrieval.metadata.panel.placeholder'], {diff --git a/web/app/components/workflow/nodes/trigger-webhook/components/generic-table.tsx b/web/app/components/workflow/nodes/trigger-webhook/components/generic-table.tsxindex bbff4e0a266..038b916cb4b 100644--- a/web/app/components/workflow/nodes/trigger-webhook/components/generic-table.tsx+++ b/web/app/components/workflow/nodes/trigger-webhook/components/generic-table.tsx@@ -127,6 +127,7 @@ const renderInputCell = (disabled={readonly}className={cn('h-6 min-w-0 rounded-none border-0 bg-transparent p-0 shadow-none',+ // oxlint-disable-next-line shadcn/no-restyle -- The table cell paints an inset focus ring around its full editable area.'hover:border-transparent hover:bg-transparent focus:border-transparent focus:bg-transparent focus:ring-0','system-sm-regular text-text-secondary placeholder:text-text-quaternary',)}diff --git a/web/app/components/workflow/variable-inspect/display-content.tsx b/web/app/components/workflow/variable-inspect/display-content.tsxindex 053d83f62a6..3aedbb08a89 100644--- a/web/app/components/workflow/variable-inspect/display-content.tsx+++ b/web/app/components/workflow/variable-inspect/display-content.tsx@@ -111,6 +111,7 @@ export function DisplayContent(props: DisplayContentProps) {})}readOnly={readonly}disabled={readonly}+ // oxlint-disable-next-line shadcn/no-restyle -- The enclosing editor surface paints the focus ring around the content and view controls.className="h-full border-none bg-transparent p-0 text-text-secondary hover:bg-transparent focus:bg-transparent focus:ring-0"value={mdString}onValueChange={(value) => handleTextChange?.(value)}diff --git a/web/features/agent-v2/agent-detail/logs/components/logs-table.tsx b/web/features/agent-v2/agent-detail/logs/components/logs-table.tsxindex 39406d21557..82148deef49 100644--- a/web/features/agent-v2/agent-detail/logs/components/logs-table.tsx+++ b/web/features/agent-v2/agent-detail/logs/components/logs-table.tsx@@ -64,7 +64,7 @@ export function AgentLogsTable({aria-label={t(($) => $['agentDetail.logs.title'])}role="region"tabIndex={0}- className="overscroll-contain focus-visible:ring-2 focus-visible:ring-state-accent-solid"+ className="overscroll-contain"><ScrollAreaContent className="pr-3"><table className="w-full min-w-[56rem] table-fixed border-collapse lg:min-w-0">