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(dify-ui): complete focus indicator ownership for overlay triggers (#43666)

yyh14edc44e2ca4
diff --git a/packages/dify-ui/docs/styling.md b/packages/dify-ui/docs/styling.md
index f76e8f2281b..3d39c5c198e 100644
--- a/packages/dify-ui/docs/styling.md
+++ b/packages/dify-ui/docs/styling.md
@@ -58,6 +58,13 @@ Use semantic Dify tokens and existing component variants before hard-coded value
primitive classes. Use an important modifier only for a tightly scoped compatibility override
after the owning variant, data attribute, and selector structure cannot express the state.
+## Focus indicator
+
+Controls own their focus indicator, so callers never write one. That includes every trigger that
+opens a surface (Popover, DropdownMenu, Collapsible, Combobox, Dialog, AlertDialog, Drawer); they
+share one ring. Rows inside a composite defer to its highlight. Parts that only attach behavior
+(Tooltip, PreviewCard, and ContextMenu triggers, and Close parts) add no styles.
+
Attach focus-visible styling to the element that visually represents focus. If a visible wrapper
contains the native focus target, select that descendant state from the wrapper; for example,
`SliderThumb` uses `has-[:focus-visible]` because its internal range input receives focus.
diff --git a/packages/dify-ui/src/alert-dialog/index.stories.tsx b/packages/dify-ui/src/alert-dialog/index.stories.tsx
index d2c17b0034d..e69f06ad54a 100644
--- a/packages/dify-ui/src/alert-dialog/index.stories.tsx
+++ b/packages/dify-ui/src/alert-dialog/index.stories.tsx
@@ -14,7 +14,7 @@ import {
import { Button } from '../button'
const triggerButtonClassName =
- 'rounded-lg border border-divider-subtle bg-components-button-secondary-bg px-3 py-1.5 text-sm text-text-secondary shadow-xs outline-hidden hover:bg-state-base-hover focus-visible:ring-2 focus-visible:ring-state-accent-solid'
+ 'rounded-lg border border-divider-subtle bg-components-button-secondary-bg px-3 py-1.5 text-sm text-text-secondary shadow-xs hover:bg-state-base-hover'
const meta = {
title: 'Base/UI/AlertDialog',
diff --git a/packages/dify-ui/src/alert-dialog/index.tsx b/packages/dify-ui/src/alert-dialog/index.tsx
index 8aab9461004..9f51c5f3a67 100644
--- a/packages/dify-ui/src/alert-dialog/index.tsx
+++ b/packages/dify-ui/src/alert-dialog/index.tsx
@@ -6,10 +6,13 @@ import { AlertDialog as BaseAlertDialog } from '@base-ui/react/alert-dialog'
import { Button } from '../button'
import { cn } from '../cn'
import { resolveClassName } from '../internals/resolve-class-name'
-import { modalBackdropClassName, modalPopupAnimationClassName } from '../overlay-shared'
+import {
+ modalBackdropClassName,
+ modalPopupAnimationClassName,
+ triggerFocusClassName,
+} from '../overlay-shared'
const AlertDialog = BaseAlertDialog.Root
-const AlertDialogTrigger = BaseAlertDialog.Trigger
const AlertDialogTitle = BaseAlertDialog.Title
const AlertDialogDescription = BaseAlertDialog.Description
@@ -17,6 +20,18 @@ type AlertDialogActions = BaseAlertDialog.Root.Actions
type AlertDialogProps<Payload = unknown> = BaseAlertDialog.Root.Props<Payload>
type AlertDialogTriggerProps<Payload = unknown> = BaseAlertDialog.Trigger.Props<Payload>
+
+function AlertDialogTrigger<Payload = unknown>({
+ className,
+ ...props
+}: AlertDialogTriggerProps<Payload>) {
+ return (
+ <BaseAlertDialog.Trigger
+ className={(state) => cn(triggerFocusClassName, resolveClassName(className, state))}
+ {...props}
+ />
+ )
+}
type AlertDialogTitleProps = BaseAlertDialog.Title.Props
type AlertDialogDescriptionProps = BaseAlertDialog.Description.Props
diff --git a/packages/dify-ui/src/autocomplete/__tests__/index.spec.tsx b/packages/dify-ui/src/autocomplete/__tests__/index.spec.tsx
index e6dbec5c0f6..0b05010dad0 100644
--- a/packages/dify-ui/src/autocomplete/__tests__/index.spec.tsx
+++ b/packages/dify-ui/src/autocomplete/__tests__/index.spec.tsx
@@ -1,5 +1,5 @@
import * as React from 'react'
-import { userEvent } from 'vite-plus/test/browser'
+import { page, userEvent } from 'vite-plus/test/browser'
import { render } from 'vitest-browser-react'
import {
Autocomplete,
@@ -189,6 +189,61 @@ describe('Autocomplete wrappers', () => {
})
describe('Content and options', () => {
+ it('should keep the status visible and scroll the list in a short viewport', async () => {
+ const popupRef = React.createRef<HTMLDivElement>()
+ const longOptions = Array.from({ length: 30 }, (_, index) => `Suggestion ${index + 1}`)
+ const originalViewport = {
+ height: window.innerHeight,
+ width: window.innerWidth,
+ }
+
+ await page.viewport(800, 360)
+
+ try {
+ const screen = await render(
+ <div style={{ padding: 16 }}>
+ <Autocomplete open items={longOptions}>
+ <AutocompleteInputGroup>
+ <AutocompleteInput aria-label="Search" />
+ </AutocompleteInputGroup>
+ <AutocompletePortal>
+ <AutocompletePositioner>
+ <AutocompletePopup ref={popupRef}>
+ <AutocompleteStatus>30 suggestions</AutocompleteStatus>
+ <AutocompleteList<string>>
+ {(item) => (
+ <AutocompleteItem key={item} value={item}>
+ {item}
+ </AutocompleteItem>
+ )}
+ </AutocompleteList>
+ </AutocompletePopup>
+ </AutocompletePositioner>
+ </AutocompletePortal>
+ </Autocomplete>
+ </div>,
+ )
+
+ const status = screen.getByText('30 suggestions')
+ const list = screen.getByRole('listbox')
+ await expect.element(list).toBeVisible()
+ await vi.waitFor(() => {
+ const popupBounds = popupRef.current!.getBoundingClientRect()
+ const statusBounds = status.element().getBoundingClientRect()
+
+ expect(window.innerHeight).toBe(360)
+ expect(popupBounds.top).toBeGreaterThanOrEqual(0)
+ expect(popupBounds.bottom).toBeLessThanOrEqual(window.innerHeight)
+ expect(statusBounds.top).toBeGreaterThanOrEqual(popupBounds.top)
+ expect(statusBounds.bottom).toBeLessThanOrEqual(popupBounds.bottom)
+ expect(list.element().scrollHeight).toBeGreaterThan(list.element().clientHeight)
+ expect(popupRef.current!.scrollHeight).toBeLessThanOrEqual(popupRef.current!.clientHeight)
+ })
+ } finally {
+ await page.viewport(originalViewport.width, originalViewport.height)
+ }
+ })
+
it('should use default overlay placement', async () => {
const screen = await renderAutocomplete({ open: true })
diff --git a/packages/dify-ui/src/autocomplete/index.tsx b/packages/dify-ui/src/autocomplete/index.tsx
index dd251fce4cc..bfeddde8c48 100644
--- a/packages/dify-ui/src/autocomplete/index.tsx
+++ b/packages/dify-ui/src/autocomplete/index.tsx
@@ -66,8 +66,10 @@ function AutocompleteCollection<Value = unknown>(props: AutocompleteCollectionPr
return <BaseAutocomplete.Collection {...props} />
}
+// The popup is limited to the available height and lays its parts out in a column, so a status or input
+// sharing it with the list leaves the list to shrink. The popup scrolls only when nothing can.
const autocompletePopupClassName = [
- 'w-(--anchor-width) max-w-[min(28rem,var(--available-width))] overflow-hidden rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg shadow-lg outline-hidden',
+ 'flex max-h-(--available-height) w-(--anchor-width) max-w-[min(28rem,var(--available-width))] flex-col overflow-x-hidden overflow-y-auto rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg shadow-lg outline-hidden',
]
const autocompleteListClassName = [
diff --git a/packages/dify-ui/src/combobox/__tests__/index.spec.tsx b/packages/dify-ui/src/combobox/__tests__/index.spec.tsx
index c8f4be4f351..443b5a7be87 100644
--- a/packages/dify-ui/src/combobox/__tests__/index.spec.tsx
+++ b/packages/dify-ui/src/combobox/__tests__/index.spec.tsx
@@ -1,5 +1,5 @@
import * as React from 'react'
-import { userEvent } from 'vite-plus/test/browser'
+import { page, userEvent } from 'vite-plus/test/browser'
import { render } from 'vitest-browser-react'
import {
Combobox,
@@ -277,6 +277,59 @@ describe('Combobox wrappers', () => {
})
describe('Popup anatomy and options', () => {
+ it('should keep the popup input visible and scroll the list in a short viewport', async () => {
+ const popupRef = React.createRef<HTMLDivElement>()
+ const longOptions = Array.from({ length: 30 }, (_, index) => `Resource ${index + 1}`)
+ const originalViewport = {
+ height: window.innerHeight,
+ width: window.innerWidth,
+ }
+
+ await page.viewport(800, 360)
+
+ try {
+ const screen = await render(
+ <div style={{ padding: 16 }}>
+ <Combobox open items={longOptions}>
+ <ComboboxTrigger aria-label="Resource">Choose resource</ComboboxTrigger>
+ <ComboboxPortal>
+ <ComboboxPositioner>
+ <ComboboxPopup ref={popupRef} aria-label="Choose a resource">
+ <ComboboxInput aria-label="Filter resources" />
+ <ComboboxList<string>>
+ {(item) => (
+ <ComboboxItem key={item} value={item}>
+ {item}
+ </ComboboxItem>
+ )}
+ </ComboboxList>
+ </ComboboxPopup>
+ </ComboboxPositioner>
+ </ComboboxPortal>
+ </Combobox>
+ </div>,
+ )
+
+ const input = screen.getByRole('combobox', { name: 'Filter resources' })
+ const list = screen.getByRole('listbox')
+ await expect.element(list).toBeVisible()
+ await vi.waitFor(() => {
+ const popupBounds = popupRef.current!.getBoundingClientRect()
+ const inputBounds = input.element().getBoundingClientRect()
+
+ expect(window.innerHeight).toBe(360)
+ expect(popupBounds.top).toBeGreaterThanOrEqual(0)
+ expect(popupBounds.bottom).toBeLessThanOrEqual(window.innerHeight)
+ expect(inputBounds.top).toBeGreaterThanOrEqual(popupBounds.top)
+ expect(inputBounds.bottom).toBeLessThanOrEqual(popupBounds.bottom)
+ expect(list.element().scrollHeight).toBeGreaterThan(list.element().clientHeight)
+ expect(popupRef.current!.scrollHeight).toBeLessThanOrEqual(popupRef.current!.clientHeight)
+ })
+ } finally {
+ await page.viewport(originalViewport.width, originalViewport.height)
+ }
+ })
+
it('should render source objects while exposing primitive selected values', async () => {
const onValueChange = vi.fn()
const screen = await render(
diff --git a/packages/dify-ui/src/combobox/index.tsx b/packages/dify-ui/src/combobox/index.tsx
index caeaa2d1d94..a32f977aa67 100644
--- a/packages/dify-ui/src/combobox/index.tsx
+++ b/packages/dify-ui/src/combobox/index.tsx
@@ -75,8 +75,10 @@ function ComboboxCollection<Item = unknown>(props: ComboboxCollectionProps<Item>
type ComboboxRowProps = BaseCombobox.Row.Props
+// The popup is limited to the available height and lays its parts out in a column, so an input or status
+// sharing it with the list leaves the list to shrink. The popup scrolls only when nothing can.
const comboboxPopupClassName = [
- 'w-(--anchor-width) max-w-[min(28rem,var(--available-width))] overflow-hidden rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg shadow-lg outline-hidden',
+ 'flex max-h-(--available-height) w-(--anchor-width) max-w-[min(28rem,var(--available-width))] flex-col overflow-x-hidden overflow-y-auto rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg shadow-lg outline-hidden',
]
const comboboxListClassName = [
diff --git a/packages/dify-ui/src/dialog/index.tsx b/packages/dify-ui/src/dialog/index.tsx
index e524b156b49..61b38faf723 100644
--- a/packages/dify-ui/src/dialog/index.tsx
+++ b/packages/dify-ui/src/dialog/index.tsx
@@ -4,10 +4,13 @@ import type * as React from 'react'
import { Dialog as BaseDialog } from '@base-ui/react/dialog'
import { cn } from '../cn'
import { resolveClassName } from '../internals/resolve-class-name'
-import { modalBackdropClassName, modalPopupAnimationClassName } from '../overlay-shared'
+import {
+ modalBackdropClassName,
+ modalPopupAnimationClassName,
+ triggerFocusClassName,
+} from '../overlay-shared'
const Dialog = BaseDialog.Root
-const DialogTrigger = BaseDialog.Trigger
const DialogTitle = BaseDialog.Title
const DialogDescription = BaseDialog.Description
const DialogPortal = BaseDialog.Portal
@@ -19,6 +22,15 @@ type DialogActions = BaseDialog.Root.Actions
type DialogProps<Payload = unknown> = BaseDialog.Root.Props<Payload>
type DialogHandle<Payload = unknown> = BaseDialog.Handle<Payload>
type DialogTriggerProps<Payload = unknown> = BaseDialog.Trigger.Props<Payload>
+
+function DialogTrigger<Payload = unknown>({ className, ...props }: DialogTriggerProps<Payload>) {
+ return (
+ <BaseDialog.Trigger
+ className={(state) => cn(triggerFocusClassName, resolveClassName(className, state))}
+ {...props}
+ />
+ )
+}
type DialogTitleProps = BaseDialog.Title.Props
type DialogDescriptionProps = BaseDialog.Description.Props
type DialogPortalProps = BaseDialog.Portal.Props
diff --git a/packages/dify-ui/src/drawer/index.stories.tsx b/packages/dify-ui/src/drawer/index.stories.tsx
index 13baf234663..79ffb55bbe3 100644
--- a/packages/dify-ui/src/drawer/index.stories.tsx
+++ b/packages/dify-ui/src/drawer/index.stories.tsx
@@ -31,7 +31,7 @@ import {
} from '../scroll-area'
const triggerButtonClassName =
- 'rounded-lg border border-divider-subtle bg-components-button-secondary-bg px-3 py-1.5 text-sm text-text-secondary shadow-xs outline-hidden hover:bg-state-base-hover focus-visible:ring-2 focus-visible:ring-state-accent-solid'
+ 'rounded-lg border border-divider-subtle bg-components-button-secondary-bg px-3 py-1.5 text-sm text-text-secondary shadow-xs hover:bg-state-base-hover'
const textCloseClassName =
'inline-flex h-8 items-center justify-center rounded-lg border-[0.5px] border-components-button-secondary-border bg-components-button-secondary-bg px-3.5 text-[13px] font-medium text-components-button-secondary-text shadow-xs outline-hidden hover:border-components-button-secondary-border-hover hover:bg-components-button-secondary-bg-hover focus-visible:ring-2 focus-visible:ring-state-accent-solid'
const primaryCloseClassName =
diff --git a/packages/dify-ui/src/drawer/index.tsx b/packages/dify-ui/src/drawer/index.tsx
index 75ed5240d07..fbfe86c5b61 100644
--- a/packages/dify-ui/src/drawer/index.tsx
+++ b/packages/dify-ui/src/drawer/index.tsx
@@ -3,12 +3,12 @@
import { Drawer as BaseDrawer } from '@base-ui/react/drawer'
import { cn } from '../cn'
import { resolveClassName } from '../internals/resolve-class-name'
+import { triggerFocusClassName } from '../overlay-shared'
const Drawer = BaseDrawer.Root
const DrawerProvider = BaseDrawer.Provider
const DrawerIndent = BaseDrawer.Indent
const DrawerIndentBackground = BaseDrawer.IndentBackground
-const DrawerTrigger = BaseDrawer.Trigger
const DrawerSwipeArea = BaseDrawer.SwipeArea
const DrawerPortal = BaseDrawer.Portal
const DrawerTitle = BaseDrawer.Title
@@ -24,6 +24,15 @@ type DrawerProviderProps = BaseDrawer.Provider.Props
type DrawerIndentProps = BaseDrawer.Indent.Props
type DrawerIndentBackgroundProps = BaseDrawer.IndentBackground.Props
type DrawerTriggerProps<Payload = unknown> = BaseDrawer.Trigger.Props<Payload>
+
+function DrawerTrigger<Payload = unknown>({ className, ...props }: DrawerTriggerProps<Payload>) {
+ return (
+ <BaseDrawer.Trigger
+ className={(state) => cn(triggerFocusClassName, resolveClassName(className, state))}
+ {...props}
+ />
+ )
+}
type DrawerSwipeAreaProps = BaseDrawer.SwipeArea.Props
type DrawerPortalProps = BaseDrawer.Portal.Props
type DrawerTitleProps = BaseDrawer.Title.Props
diff --git a/packages/dify-ui/src/overlay-shared.ts b/packages/dify-ui/src/overlay-shared.ts
index 6a6bcae8777..ef6ebc169c7 100644
--- a/packages/dify-ui/src/overlay-shared.ts
+++ b/packages/dify-ui/src/overlay-shared.ts
@@ -2,7 +2,7 @@ export type MenuItemVariant = 'default' | 'destructive'
// The focus indicator a trigger owns. The caller owns the appearance, directly or through `render`.
export const triggerFocusClassName =
- 'outline-hidden focus-visible:ring-2 focus-visible:ring-state-accent-solid'
+ 'focus-visible:ring-2 focus-visible:ring-state-accent-solid focus-visible:outline-hidden'
export const menuItemClassName =
'mx-1 flex h-8 cursor-pointer select-none items-center gap-1 rounded-lg px-2 outline-hidden data-highlighted:bg-state-base-hover data-disabled:cursor-not-allowed data-disabled:opacity-30'
diff --git a/packages/dify-ui/src/select/__tests__/index.spec.tsx b/packages/dify-ui/src/select/__tests__/index.spec.tsx
index 7f8e030dbc6..f4e33d1f23a 100644
--- a/packages/dify-ui/src/select/__tests__/index.spec.tsx
+++ b/packages/dify-ui/src/select/__tests__/index.spec.tsx
@@ -218,6 +218,49 @@ describe('Select wrappers', () => {
}
})
+ it('should keep a long list inside a short viewport and let it scroll', async () => {
+ const popupRef = React.createRef<HTMLDivElement>()
+ const longOptions = Array.from({ length: 30 }, (_, index) => `option-${index + 1}`)
+ const originalViewport = {
+ height: window.innerHeight,
+ width: window.innerWidth,
+ }
+
+ await page.viewport(800, 360)
+
+ try {
+ const screen = await render(
+ <div style={{ padding: 16 }}>
+ <Select open defaultValue="option-1">
+ <SelectTrigger aria-label="deployment target">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent ref={popupRef}>
+ {longOptions.map((option) => (
+ <SelectItem key={option} value={option}>
+ <SelectItemText>{option}</SelectItemText>
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </div>,
+ )
+
+ const list = screen.getByRole('listbox')
+ await expect.element(list).toBeVisible()
+ await vi.waitFor(() => {
+ const popupBounds = popupRef.current!.getBoundingClientRect()
+
+ expect(window.innerHeight).toBe(360)
+ expect(popupBounds.top).toBeGreaterThanOrEqual(0)
+ expect(popupBounds.bottom).toBeLessThanOrEqual(window.innerHeight)
+ expect(list.element().scrollHeight).toBeGreaterThan(list.element().clientHeight)
+ })
+ } finally {
+ await page.viewport(originalViewport.width, originalViewport.height)
+ }
+ })
+
it('should preserve an explicit popup width when the viewport has enough space', async () => {
const popupRef = React.createRef<HTMLDivElement>()
const originalViewport = {
diff --git a/packages/dify-ui/src/select/index.tsx b/packages/dify-ui/src/select/index.tsx
index 5bd41d21dac..2516d04a071 100644
--- a/packages/dify-ui/src/select/index.tsx
+++ b/packages/dify-ui/src/select/index.tsx
@@ -178,7 +178,7 @@ function SelectPopup({ className, ...props }: SelectPopupProps) {
<BaseSelect.Popup
className={(state) =>
cn(
- 'max-w-(--available-width) min-w-[min(var(--anchor-width),var(--available-width))] overflow-hidden rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg shadow-lg outline-hidden',
+ 'flex max-h-(--available-height) max-w-(--available-width) min-w-[min(var(--anchor-width),var(--available-width))] flex-col overflow-x-hidden overflow-y-auto rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg shadow-lg outline-hidden',
floatingPopupAnimationClassName,
resolveClassName(className, state),
)
diff --git a/web/app/account/(commonLayout)/account-page/edit-account-name-dialog.tsx b/web/app/account/(commonLayout)/account-page/edit-account-name-dialog.tsx
index a0ca87e19cd..cf1db4e607f 100644
--- a/web/app/account/(commonLayout)/account-page/edit-account-name-dialog.tsx
+++ b/web/app/account/(commonLayout)/account-page/edit-account-name-dialog.tsx
@@ -85,7 +85,7 @@ export function EditAccountNameDialog({ name }: { name: string }) {
details.cancel()
}}
>
- <DialogTrigger className="cursor-pointer rounded-lg bg-components-button-tertiary-bg px-3 py-2 system-sm-medium text-components-button-tertiary-text focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-state-accent-solid">
+ <DialogTrigger className="cursor-pointer rounded-lg bg-components-button-tertiary-bg px-3 py-2 system-sm-medium text-components-button-tertiary-text">
{t(($) => $['operation.edit'])}
</DialogTrigger>
<DialogContent className="w-105 p-6">
diff --git a/web/app/components/app-sidebar/app-detail-top.tsx b/web/app/components/app-sidebar/app-detail-top.tsx
index 121e327ff3a..f30f6b6085a 100644
--- a/web/app/components/app-sidebar/app-detail-top.tsx
+++ b/web/app/components/app-sidebar/app-detail-top.tsx
@@ -80,7 +80,7 @@ export function AppDetailTop({ expand = true, onToggle }: AppDetailTopProps) {
<button
type="button"
aria-label={t(($) => $['gotoAnything.searchTitle'], { ns: 'app' })}
- className="flex size-8 shrink-0 items-center justify-center overflow-hidden rounded-[10px] text-text-tertiary transition-colors hover:bg-state-base-hover hover:text-text-secondary focus-visible:ring-2 focus-visible:ring-state-accent-solid focus-visible:outline-hidden"
+ className="flex size-8 shrink-0 items-center justify-center overflow-hidden rounded-[10px] text-text-tertiary transition-colors hover:bg-state-base-hover hover:text-text-secondary"
>
<span aria-hidden className="i-custom-vender-main-nav-quick-search size-4" />
</button>
diff --git a/web/app/components/app-sidebar/dataset-detail-top.tsx b/web/app/components/app-sidebar/dataset-detail-top.tsx
index 58dc247fd35..950d6a81329 100644
--- a/web/app/components/app-sidebar/dataset-detail-top.tsx
+++ b/web/app/components/app-sidebar/dataset-detail-top.tsx
@@ -83,7 +83,7 @@ export function DatasetDetailTop({ expand = true, onToggle }: DatasetDetailTopPr
<button
type="button"
aria-label={t(($) => $['gotoAnything.searchTitle'], { ns: 'app' })}
- className="flex size-8 shrink-0 items-center justify-center overflow-hidden rounded-[10px] text-text-tertiary transition-colors hover:bg-state-base-hover hover:text-text-secondary focus-visible:ring-2 focus-visible:ring-state-accent-solid focus-visible:outline-hidden"
+ className="flex size-8 shrink-0 items-center justify-center overflow-hidden rounded-[10px] text-text-tertiary transition-colors hover:bg-state-base-hover hover:text-text-secondary"
>
<span aria-hidden className="i-custom-vender-main-nav-quick-search size-4" />
</button>
diff --git a/web/app/components/app/log/list.tsx b/web/app/components/app/log/list.tsx
index f30b70bb89d..536a31fadb9 100644
--- a/web/app/components/app/log/list.tsx
+++ b/web/app/components/app/log/list.tsx
@@ -1027,7 +1027,7 @@ const ConversationList: FC<IConversationList> = ({ logs, appDetail, onRefresh })
<td className="w-40 p-3 pr-2">
<DrawerTrigger
data-log-detail-trigger
- className="w-full cursor-pointer rounded-sm text-left focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-state-accent-solid"
+ className="w-full cursor-pointer rounded-sm text-left"
onClick={(event) => {
event.stopPropagation()
handleRowClick(log)
diff --git a/web/app/components/app/workflow-log/list.tsx b/web/app/components/app/workflow-log/list.tsx
index 3dc585d15eb..cb190f8b711 100644
--- a/web/app/components/app/workflow-log/list.tsx
+++ b/web/app/components/app/workflow-log/list.tsx
@@ -239,7 +239,7 @@ const WorkflowAppLogList: FC<ILogs> = ({ logs, appDetail, onRefresh }) => {
<td className="w-45 p-3 pr-2">
<DrawerTrigger
data-log-detail-trigger
- className="w-full cursor-pointer rounded-sm text-left focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-state-accent-solid"
+ className="w-full cursor-pointer rounded-sm text-left"
onClick={(event) => {
event.stopPropagation()
setCurrentLog(log)
diff --git a/web/app/components/apps/import-from-marketplace-template-modal.tsx b/web/app/components/apps/import-from-marketplace-template-modal.tsx
index 5d23f4c93e9..76fb5bab47d 100644
--- a/web/app/components/apps/import-from-marketplace-template-modal.tsx
+++ b/web/app/components/apps/import-from-marketplace-template-modal.tsx
@@ -2,6 +2,7 @@
import { Button } from '@langgenius/dify-ui/button'
import { Dialog, DialogClose, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
+import { IconButton } from '@langgenius/dify-ui/icon-button'
import { RiCloseLine } from '@remixicon/react'
import { useCallback, useMemo, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
@@ -79,13 +80,13 @@ const ImportFromMarketplaceTemplateModal = ({
</DialogTitle>
<DialogClose
render={
- <button
- type="button"
+ <IconButton
+ size="lg"
aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- className="flex size-8 cursor-pointer items-center border-none bg-transparent p-0 outline-hidden focus-visible:ring-2 focus-visible:ring-state-accent-solid"
+ className="mr-1.5"
>
- <RiCloseLine aria-hidden className="size-5 text-text-tertiary" />
- </button>
+ <RiCloseLine aria-hidden className="size-5" />
+ </IconButton>
}
/>
</div>
diff --git a/web/app/components/header/account-setting/update-setting-dialog-form.tsx b/web/app/components/header/account-setting/update-setting-dialog-form.tsx
index a16c9782432..a659827f0b0 100644
--- a/web/app/components/header/account-setting/update-setting-dialog-form.tsx
+++ b/web/app/components/header/account-setting/update-setting-dialog-form.tsx
@@ -51,7 +51,7 @@ function SettingTimeZone({ children }: { children?: ReactNode }) {
return (
<DialogClose
- className="cursor-pointer border-none bg-transparent p-0 text-left body-xs-regular text-text-accent focus-visible:ring-1 focus-visible:ring-components-input-border-active focus-visible:outline-hidden"
+ className="cursor-pointer border-none bg-transparent p-0 text-left body-xs-regular text-text-accent focus-visible:ring-2 focus-visible:ring-state-accent-solid focus-visible:outline-hidden"
onClick={() => {
if (settingsDestination)
setSettingsDestination('preferences', { history: 'replace', shallow: true })
diff --git a/web/app/components/main-nav/components/help-menu.tsx b/web/app/components/main-nav/components/help-menu.tsx
index d8d32616102..8960a1d13e8 100644
--- a/web/app/components/main-nav/components/help-menu.tsx
+++ b/web/app/components/main-nav/components/help-menu.tsx
@@ -158,13 +158,13 @@ const HelpMenu = ({ triggerIcon, triggerClassName, triggerRef, triggerSize }: He
<DropdownMenuTrigger
ref={triggerRef}
data-learn-dify-help-target
- className="focus-visible:ring-0"
+ // The recovery pulse animates box-shadow, so focus is drawn with an outline instead of 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={
<IconButton
size={triggerSize ?? 'lg'}
aria-label={t(($) => $['mainNav.help.openMenu'], { ns: 'navigation' })}
className={cn(
- 'focus-visible:ring-0 focus-visible:outline-2 focus-visible:outline-offset-0 focus-visible:outline-state-accent-solid focus-visible:outline-solid',
usesDefaultTrigger && [
'rounded-full border border-components-card-border bg-components-card-bg text-text-tertiary shadow-xs transition-colors hover:bg-components-card-bg-alt hover:text-saas-dify-blue-inverted',
!triggerSize && 'size-7 p-0',
diff --git a/web/app/components/main-nav/components/search-button.tsx b/web/app/components/main-nav/components/search-button.tsx
index a488d3f8f9f..d6d3b104afc 100644
--- a/web/app/components/main-nav/components/search-button.tsx
+++ b/web/app/components/main-nav/components/search-button.tsx
@@ -41,7 +41,7 @@ export function MainNavSearchButton({
type="button"
aria-label={t(($) => $['gotoAnything.searchTitle'], { ns: 'app' })}
aria-keyshortcuts={ariaKeyShortcuts}
- className="flex h-8 items-center gap-1.5 overflow-hidden rounded-[10px] p-2 text-text-tertiary transition-colors hover:bg-state-base-hover hover:text-text-secondary focus-visible:ring-2 focus-visible:ring-state-accent-solid focus-visible:outline-hidden"
+ className="flex h-8 items-center gap-1.5 overflow-hidden rounded-[10px] p-2 text-text-tertiary transition-colors hover:bg-state-base-hover hover:text-text-secondary"
/>
}
>
diff --git a/web/app/components/main-nav/components/workspace-card.tsx b/web/app/components/main-nav/components/workspace-card.tsx
index eaa713ff734..b3583d08608 100644
--- a/web/app/components/main-nav/components/workspace-card.tsx
+++ b/web/app/components/main-nav/components/workspace-card.tsx
@@ -125,7 +125,7 @@ function WorkspaceCardTrigger({
onMouseEnter={onPrefetchWorkspaces}
onFocus={onPrefetchWorkspaces}
className={cn(
- 'flex w-full items-center gap-1.5 py-1.5 pr-3 pl-1.5 text-left transition-colors hover:bg-state-base-hover focus-visible:ring-0 focus-visible:inset-ring-2 focus-visible:inset-ring-state-accent-solid',
+ 'flex w-full items-center gap-1.5 py-1.5 pr-3 pl-1.5 text-left transition-colors hover:bg-state-base-hover focus-visible:ring-inset',
showCloudBilling ? 'rounded-t-xl' : 'rounded-xl',
'data-popup-open:bg-linear-to-b data-popup-open:from-background-section-burn data-popup-open:to-background-section',
)}
diff --git a/web/app/components/plugins/plugin-detail-panel/tool-selector/components/tool-item.tsx b/web/app/components/plugins/plugin-detail-panel/tool-selector/components/tool-item.tsx
index f88361be5e4..2a0e5c5fbe1 100644
--- a/web/app/components/plugins/plugin-detail-panel/tool-selector/components/tool-item.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/tool-selector/components/tool-item.tsx
@@ -79,13 +79,12 @@ export function ToolItem({
)}
>
<PopoverTrigger
- className="focus-visible:ring-0"
render={
<button
ref={triggerRef}
type="button"
aria-label={accessibleTriggerLabel}
- className="absolute inset-0 z-0 cursor-pointer rounded-lg border-0 bg-transparent focus-visible:inset-ring-2 focus-visible:inset-ring-state-accent-solid"
+ className="absolute inset-0 z-0 cursor-pointer rounded-lg border-0 bg-transparent focus-visible:ring-inset"
/>
}
/>
diff --git a/web/app/components/snippets/components/snippet-detail-top.tsx b/web/app/components/snippets/components/snippet-detail-top.tsx
index 72b9be1c865..96791b28189 100644
--- a/web/app/components/snippets/components/snippet-detail-top.tsx
+++ b/web/app/components/snippets/components/snippet-detail-top.tsx
@@ -84,7 +84,7 @@ export function SnippetDetailTop({ expand = true, onToggle }: SnippetDetailTopPr
<button
type="button"
aria-label={t(($) => $['gotoAnything.searchTitle'], { ns: 'app' })}
- className="flex size-8 shrink-0 items-center justify-center overflow-hidden rounded-[10px] text-text-tertiary transition-colors hover:bg-state-base-hover hover:text-text-secondary focus-visible:ring-2 focus-visible:ring-state-accent-solid focus-visible:outline-hidden"
+ className="flex size-8 shrink-0 items-center justify-center overflow-hidden rounded-[10px] text-text-tertiary transition-colors hover:bg-state-base-hover hover:text-text-secondary"
>
<span aria-hidden className="i-custom-vender-main-nav-quick-search size-4" />
</button>
diff --git a/web/app/components/workflow/header/checklist/index.tsx b/web/app/components/workflow/header/checklist/index.tsx
index fe2b0cc5316..2b96fdda4c9 100644
--- a/web/app/components/workflow/header/checklist/index.tsx
+++ b/web/app/components/workflow/header/checklist/index.tsx
@@ -1,6 +1,7 @@
import type { ChecklistItem } from '../../hooks/use-checklist'
import type { CommonEdgeType } from '../../types'
import { cn } from '@langgenius/dify-ui/cn'
+import { IconButton } from '@langgenius/dify-ui/icon-button'
import {
Popover,
PopoverClose,
@@ -108,11 +109,16 @@ const WorkflowChecklist = ({ disabled, showGoTo = true, onItemClick }: WorkflowC
</PopoverTitle>
</div>
<PopoverClose
- className="-mt-0.5 -mr-0.5 flex size-7 shrink-0 items-center justify-center rounded-lg"
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- >
- <span className="i-ri-close-line size-4 text-text-tertiary" aria-hidden="true" />
- </PopoverClose>
+ render={
+ <IconButton
+ size="lg"
+ aria-label={t(($) => $['operation.close'], { ns: 'common' })}
+ className="-mt-1 -mr-1 shrink-0"
+ >
+ <span className="i-ri-close-line size-4" aria-hidden="true" />
+ </IconButton>
+ }
+ />
</div>
{needWarningNodes.length > 0 && (
<PopoverDescription className="px-1 text-xs/4 text-text-tertiary">
diff --git a/web/app/components/workflow/nodes/http/components/authorization/index.tsx b/web/app/components/workflow/nodes/http/components/authorization/index.tsx
index 79336d6f05c..88498e2a7f6 100644
--- a/web/app/components/workflow/nodes/http/components/authorization/index.tsx
+++ b/web/app/components/workflow/nodes/http/components/authorization/index.tsx
@@ -271,7 +271,7 @@ export function AuthorizationDialog({
return (
<Dialog actionsRef={actionsRef}>
- <DialogTrigger className="flex h-6 cursor-pointer items-center space-x-1 rounded-md px-2 hover:bg-state-base-hover focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-state-accent-solid">
+ <DialogTrigger className="flex h-6 cursor-pointer items-center space-x-1 rounded-md px-2 hover:bg-state-base-hover">
<span
aria-hidden
className="i-custom-vender-line-general-settings-01 size-3 text-text-tertiary"
diff --git a/web/app/components/workflow/nodes/http/components/curl-import-dialog.tsx b/web/app/components/workflow/nodes/http/components/curl-import-dialog.tsx
index 50791dd96ea..71bd1b882d5 100644
--- a/web/app/components/workflow/nodes/http/components/curl-import-dialog.tsx
+++ b/web/app/components/workflow/nodes/http/components/curl-import-dialog.tsx
@@ -71,7 +71,7 @@ export function CurlImportDialog({ readOnly, onImport }: CurlImportDialogProps)
return (
<Dialog actionsRef={actionsRef}>
- <DialogTrigger className="flex h-6 cursor-pointer items-center space-x-1 rounded-md px-2 hover:bg-state-base-hover focus-visible:ring-2 focus-visible:ring-state-accent-solid focus-visible:outline-hidden">
+ <DialogTrigger className="flex h-6 cursor-pointer items-center space-x-1 rounded-md px-2 hover:bg-state-base-hover">
<span
aria-hidden
className="i-custom-vender-line-files-file-arrow-01 size-3 text-text-tertiary"
diff --git a/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/json-schema-config.tsx b/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/json-schema-config.tsx
index 1775bc50eee..70adecb843d 100644
--- a/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/json-schema-config.tsx
+++ b/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/json-schema-config.tsx
@@ -2,6 +2,7 @@ import type { SchemaRoot } from '../../types'
import { Button } from '@langgenius/dify-ui/button'
import { cn } from '@langgenius/dify-ui/cn'
import { DialogClose, DialogTitle } from '@langgenius/dify-ui/dialog'
+import { IconButton } from '@langgenius/dify-ui/icon-button'
import { Separator } from '@langgenius/dify-ui/separator'
import { Tabs, TabsList, TabsPanel, TabsTab } from '@langgenius/dify-ui/tabs'
import { useState } from 'react'
@@ -202,11 +203,16 @@ function JsonSchemaConfigContent({ defaultSchema, onSave }: JsonSchemaConfigProp
{t(($) => $['nodes.llm.jsonSchema.title'], { ns: 'workflowModels' })}
</DialogTitle>
<DialogClose
- className="absolute top-5 right-5 flex size-8 items-center justify-center p-1.5"
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- >
- <span aria-hidden className="i-ri-close-line h-4.5 w-4.5 text-text-tertiary" />
- </DialogClose>
+ render={
+ <IconButton
+ size="lg"
+ aria-label={t(($) => $['operation.close'], { ns: 'common' })}
+ className="absolute top-5 right-5"
+ >
+ <span aria-hidden className="i-ri-close-line h-4.5 w-4.5" />
+ </IconButton>
+ }
+ />
</div>
<div className="flex items-center justify-between px-6 py-2">
<TabsList
diff --git a/web/app/components/workflow/nodes/llm/components/structure-output.tsx b/web/app/components/workflow/nodes/llm/components/structure-output.tsx
index af2569005a8..db8af498aca 100644
--- a/web/app/components/workflow/nodes/llm/components/structure-output.tsx
+++ b/web/app/components/workflow/nodes/llm/components/structure-output.tsx
@@ -64,7 +64,7 @@ export function StructureOutput({ className, value, onChange, readOnly }: Props)
) : (
<DialogTrigger
handle={dialogHandle}
- className="mt-1.5 flex h-10 w-full cursor-pointer items-center justify-center rounded-[10px] bg-background-section system-xs-regular text-text-tertiary focus-visible:ring-2 focus-visible:ring-state-accent-solid focus-visible:outline-hidden"
+ className="mt-1.5 flex h-10 w-full cursor-pointer items-center justify-center rounded-[10px] bg-background-section system-xs-regular text-text-tertiary"
>
{t(($) => $['structOutput.notConfiguredTip'], { ns: 'app' })}
</DialogTrigger>
diff --git a/web/features/agent-v2/agent-detail/configure/components/orchestrate/files/index.tsx b/web/features/agent-v2/agent-detail/configure/components/orchestrate/files/index.tsx
index 2040ab6e4f4..b36e16b3b8c 100644
--- a/web/features/agent-v2/agent-detail/configure/components/orchestrate/files/index.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/orchestrate/files/index.tsx
@@ -316,7 +316,7 @@ function AgentFileItem({
aria-current={selected ? 'true' : undefined}
disabled={file.isMissing}
className={cn(
- 'group/file-tree-row relative flex h-full min-w-0 flex-1 cursor-pointer items-center rounded-md pl-2 text-left outline-hidden select-none focus-visible:inset-ring-2 focus-visible:inset-ring-state-accent-solid',
+ 'group/file-tree-row relative flex h-full min-w-0 flex-1 cursor-pointer items-center rounded-md pl-2 text-left select-none focus-visible:ring-inset',
file.isMissing && 'cursor-default pr-6',
)}
/>
diff --git a/web/features/agent-v2/agent-detail/navigation.tsx b/web/features/agent-v2/agent-detail/navigation.tsx
index af2d9fc3aeb..eb7775cdb56 100644
--- a/web/features/agent-v2/agent-detail/navigation.tsx
+++ b/web/features/agent-v2/agent-detail/navigation.tsx
@@ -133,7 +133,7 @@ export function AgentDetailTop({ expand = true, onToggle }: AgentDetailTopProps)
<button
type="button"
aria-label={tApp(($) => $['gotoAnything.searchTitle'])}
- className="flex size-8 shrink-0 items-center justify-center overflow-hidden rounded-[10px] text-text-tertiary transition-colors hover:bg-state-base-hover hover:text-text-secondary focus-visible:ring-2 focus-visible:ring-state-accent-solid focus-visible:outline-hidden"
+ className="flex size-8 shrink-0 items-center justify-center overflow-hidden rounded-[10px] text-text-tertiary transition-colors hover:bg-state-base-hover hover:text-text-secondary"
>
<span aria-hidden className="i-custom-vender-main-nav-quick-search size-4" />
</button>
diff --git a/web/features/skills/detail/file-tree.tsx b/web/features/skills/detail/file-tree.tsx
index 560e33a1efe..3b8aec8e682 100644
--- a/web/features/skills/detail/file-tree.tsx
+++ b/web/features/skills/detail/file-tree.tsx
@@ -1248,7 +1248,7 @@ export function FileTree({
<button
type="button"
aria-label={tApp(($) => $['gotoAnything.searchTitle'])}
- className="flex size-8 shrink-0 items-center justify-center overflow-hidden rounded-[10px] text-text-tertiary transition-colors hover:bg-state-base-hover hover:text-text-secondary focus-visible:ring-2 focus-visible:ring-state-accent-solid focus-visible:outline-hidden"
+ className="flex size-8 shrink-0 items-center justify-center overflow-hidden rounded-[10px] text-text-tertiary transition-colors hover:bg-state-base-hover hover:text-text-secondary"
>
<span
aria-hidden
diff --git a/web/features/tag-management/components/tag-search-content.tsx b/web/features/tag-management/components/tag-search-content.tsx
index 5c23abaacb7..3dd84d8cf57 100644
--- a/web/features/tag-management/components/tag-search-content.tsx
+++ b/web/features/tag-management/components/tag-search-content.tsx
@@ -57,7 +57,7 @@ export const TagSearchContentView = ({
}
return (
- <div className="relative w-full">
+ <>
<div className="p-2 pb-1">
<ComboboxInputGroup className="border-divider-subtle bg-components-input-bg-normal">
<span
@@ -153,7 +153,7 @@ export const TagSearchContentView = ({
</div>
</>
)}
- </div>
+ </>
)
}