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.

chore: remove redundant aria-label attributes (#41724)

Joelaee0062cb200
diff --git a/.agents/skills/frontend-code-review/references/accessibility-ui.md b/.agents/skills/frontend-code-review/references/accessibility-ui.md
index 92764786b15..eb9cdd47728 100644
--- a/.agents/skills/frontend-code-review/references/accessibility-ui.md
+++ b/.agents/skills/frontend-code-review/references/accessibility-ui.md
@@ -2,6 +2,8 @@
Accessibility findings are first-class review findings. Treat broken keyboard access, missing accessible names, focus loss, and unreachable popup content as correctness bugs, not polish.
+## Review Evidence
+
Before finalizing UI or accessibility findings, fetch the latest Web Interface Guidelines as a required baseline:
```text
@@ -21,13 +23,26 @@ Flag:
- Clickable `div` or `span` used for actions.
- Router navigation implemented with button or `onClick` when a `Link` / `<a>` is the real semantic element.
-- Icon-only buttons without `aria-label` or `aria-labelledby`.
+- Icon-only controls without an accessible name; follow the naming rules below and the Dify UI `IconButton` contract.
- Decorative icons missing `aria-hidden="true"`.
- Images without `alt`; use `alt=""` only when truly decorative.
- Heading levels that skip hierarchy in page-level content.
Prefer semantic HTML before ARIA.
+## Accessible Names And Descriptions
+
+Read [Accessible names and descriptions] when a change affects labels, ARIA naming, help/error relationships, or hidden text. That document owns the shared implementation and review contract.
+
+Flag violations supported by the final rendered behavior:
+
+- Missing or insufficient names, redundant name overrides, or naming attributes prohibited by the element's role.
+- Overrides that omit visible label wording or suppress necessary descendant information.
+- Broken or stale label/description references, including relationships lost when responsive content or overlays unmount.
+- Descriptions used instead of names, repeated help text, or essential structured content available only as a flattened description.
+
+Inspect the computed name and description in the relevant state. Matching an `aria-label` string to nearby text alone does not prove redundancy.
+
## Keyboard And Focus
Flag:
@@ -56,7 +71,7 @@ Flag:
- Placeholder text used as the only label.
- Password managers accidentally triggered on non-auth fields because autocomplete is missing or wrong.
-Prefer visible labels. If visible surrounding text already labels the control, use a visually hidden label or a precise `aria-label`.
+Prefer visible labels and associate them through the appropriate field primitive, a native `label`, or `aria-labelledby`. Do not duplicate an existing label with hidden text or `aria-label`; follow [Accessible names and descriptions] when no suitable visible label exists.
## Disabled, Loading, And Async States
@@ -107,3 +122,5 @@ Flag:
- Images without dimensions.
- Loading copy using `...` instead of `…`.
- Hardcoded dates, times, numbers, or currency formats instead of `Intl.*`.
+
+[Accessible names and descriptions]: ../../../../packages/dify-ui/docs/accessible-names-and-descriptions.md
diff --git a/packages/dify-ui/AGENTS.md b/packages/dify-ui/AGENTS.md
index 2cd05f418f9..5e17256c562 100644
--- a/packages/dify-ui/AGENTS.md
+++ b/packages/dify-ui/AGENTS.md
@@ -19,6 +19,7 @@ then read only the guide for the contract being changed.
- Imports, exports, naming, public types, generics, and anatomy: [Public API authoring]
- Button and icon-only action behavior: [Button contract] and [Icon Button contract]
+- Cross-component accessible-name and description choices: [Accessible names and descriptions]
- Compound input behavior: [Input Group contract]
- Form structure, labels, and value ownership: [Forms]
- Picker choice and typed values: [Selection]
@@ -29,6 +30,7 @@ then read only the guide for the contract being changed.
A component needs a local README only when it owns a substantial Dify-specific contract that its
types, stories, and upstream documentation do not express. Do not create one for completeness.
+[Accessible names and descriptions]: docs/accessible-names-and-descriptions.md
[Button contract]: src/button/README.md
[Forms]: docs/forms.md
[Icon Button contract]: src/icon-button/README.md
diff --git a/packages/dify-ui/README.md b/packages/dify-ui/README.md
index 622b4f556b4..645665fb89e 100644
--- a/packages/dify-ui/README.md
+++ b/packages/dify-ui/README.md
@@ -68,20 +68,22 @@ Upstream behavior remains owned by the [Base UI documentation].
### Cross-component guides
-| Guide | Scope |
-| ------------------------- | ------------------------------------------------------------------------------ |
-| [Forms] | Native submit boundaries, value ownership, fields, labels, and errors. |
-| [Selection] | Typed values and choosing among segmented controls, pickers, and radio groups. |
-| [Overlays] | Portals, presence lifecycles, layering, trigger composition, and semantics. |
-| [Styling] | Tailwind CSS integration and the Figma radius mapping. |
-| [Public API authoring] | Subpath exports, naming, public types, generics, and private helpers. |
-| [Testing and development] | Package commands, test ownership, accessibility, and animation setup. |
+| Guide | Scope |
+| ----------------------------------- | ------------------------------------------------------------------------------ |
+| [Accessible names and descriptions] | Naming sources, descriptions, overrides, and safe label removal. |
+| [Forms] | Native submit boundaries, value ownership, fields, labels, and errors. |
+| [Selection] | Typed values and choosing among segmented controls, pickers, and radio groups. |
+| [Overlays] | Portals, presence lifecycles, layering, trigger composition, and semantics. |
+| [Styling] | Tailwind CSS integration and the Figma radius mapping. |
+| [Public API authoring] | Subpath exports, naming, public types, generics, and private helpers. |
+| [Testing and development] | Package commands, test ownership, accessibility, and animation setup. |
## Contributing
Read [component authoring rules] before modifying the package, then open only the matching owner
guide. This index intentionally does not duplicate those contracts.
+[Accessible names and descriptions]: ./docs/accessible-names-and-descriptions.md
[Base UI documentation]: https://base-ui.com/llms.txt
[Base UI]: https://base-ui.com/react
[Button]: ./src/button/README.md
diff --git a/packages/dify-ui/docs/accessible-names-and-descriptions.md b/packages/dify-ui/docs/accessible-names-and-descriptions.md
new file mode 100644
index 00000000000..d948c3290ff
--- /dev/null
+++ b/packages/dify-ui/docs/accessible-names-and-descriptions.md
@@ -0,0 +1,175 @@
+# Accessible Names and Descriptions
+
+This cross-component contract is owned by Dify UI. It applies to Dify UI primitives and to
+consumers composing those primitives. It depends only on Dify UI component contracts and upstream
+web standards; application packages may add localization, testing, and product-specific rules
+without redefining this contract.
+
+[Base UI accessibility] owns the primitive mechanics it implements, such as roles, relationships,
+keyboard interaction, and focus management. Dify UI and its consumers still own the final element,
+label content, composition, and product meaning. Use this guide to choose those naming and
+description sources. Open a component guide only when the decision reaches that component.
+
+Use [ARIA in HTML][html-naming] for authoring conformance and the [name and description computation
+specification][accname] to understand the current computation model. APG and MDN provide authoring
+guidance; Base UI documents the behavior and usage guidance of the primitives Dify wraps. The Dify
+conventions below choose among valid options without making a prohibited naming relationship valid.
+
+## Start Here
+
+An accessible name is the flat string that identifies a named element to assistive technology; not
+every role permits one. An accessible description adds optional help, instructions, or consequences.
+State such as checked, expanded, or disabled remains separate from the name, and changing status
+remains with the feature's status or live-region owner.
+
+For each changed element:
+
+1. Inspect the final rendered element, role, text, and props forwarded by its primitive.
+1. Prefer meaningful visible text or a native label relationship.
+1. Use `aria-labelledby` when suitable visible text exists elsewhere in the DOM.
+1. Use `aria-label` only when the role permits naming and no visible text can provide the name.
+1. Add `aria-describedby` only for useful supplemental text; do not repeat the name.
+1. Verify the computed name and description in every changed responsive and interaction state.
+
+These choices follow the [W3C APG naming techniques][apg] and [MDN `aria-label` guidance]. Nearby
+text is not a label relationship by proximity alone.
+
+## Common Decisions
+
+| Surface | Contract |
+| -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
+| Text button or link | Follow [Button]. Let meaningful child text name the action; do not repeat it in `aria-label`. |
+| Form control | Follow [Forms]. Use its label primitive or an associated native `label`, preserving label activation. |
+| Icon-only command | Follow [IconButton]. Its component-specific contract requires one accessible-name source and a decorative glyph. |
+| Dialog or named region | Reuse the visible title through the primitive title API or `aria-labelledby`; use `aria-label` only when no suitable visible title exists. |
+| Related form-control group | Follow [Forms]. Use `Fieldset` with `FieldsetLegend` and preserve each control's own label. Other composite widgets follow their owning primitive. |
+| Table or figure | Prefer `caption` or `figcaption` when appropriate. See the [APG caption guidance][captions] for name and description differences. |
+| Image | Supply meaningful `alt`, or `alt=""` for a decorative image. |
+| Plain `div` or `span` | Keep readable content; do not add `aria-label` or `aria-labelledby` to the default `generic` role. |
+
+Naming permission comes from semantics, not the presence of an `aria-*` prop. Other roles also
+prohibit naming. Do not invent a role merely to permit a label. A plain span may contain text
+referenced by another element's `aria-labelledby`; that relationship names the referencing element,
+not the span. Check [ARIA in HTML][html-naming] for restrictions on the final element.
+
+## Names, Descriptions, and State
+
+A description is optional when the name is sufficient. For a file action, the name might identify
+the operation and file, while the description explains retention or recovery. Avoid repeating the
+same sentence in both. See the [name and description computation specification][accname].
+
+A name or description attribute is not an announcement mechanism. Keep progress and asynchronous
+updates with their existing feature owner. Follow [Button] for loading behavior and [Forms] for
+field error relationships.
+
+## Overrides and References
+
+Authoring preference differs from computation priority. An `aria-labelledby` value with at least
+one valid ID reference is evaluated first. If its computed text is non-empty, it takes precedence
+over `aria-label` and normal native or content naming. If its result is empty, name computation
+continues to lower-priority sources; do not rely on that fallback to excuse a broken reference. A
+non-empty `aria-label` also overrides normal native or content naming; these sources are not
+concatenated. See the [computation steps][computation].
+
+- With `aria-labelledby`, reference the intended text directly. Multiple IDs are read in attribute
+ order; do not build chains of elements that each use `aria-labelledby`.
+- Overriding a button or link's content-derived name can suppress meaningful descendant content in
+ its accessible representation. Preserve the necessary visible wording in the resulting name.
+- Inspect IDs generated by primitives before overriding them. Keep IDs unique across repeated rows
+ and simultaneous dialogs, and ensure referenced nodes exist in relevant open, closed, and
+ responsive states. Preserve existing description IDs when adding another relationship.
+- Do not use `title`, `placeholder`, or Tooltip content as the only naming source. Native `title`
+ does not replace an intentional name or description relationship.
+
+## Write Useful Names
+
+Keep the visible label's wording in the accessible name, preferably at the beginning. Add target
+context when identical visible actions would otherwise be ambiguous. Matching visible words also
+lets speech-input users invoke what they see. See [WCAG Label in Name][label-in-name].
+
+Use concise action or purpose wording. Avoid appending role words already announced by assistive
+technology or duplicating state exposed by the control. Consumers own localization and pass the
+complete localized text through public props or children; Dify UI primitives do not import
+application i18n.
+
+The following fragment assumes localized strings and owner-scoped unique IDs. It combines the
+visible action with the file it affects:
+
+```tsx
+<>
+ <span id={fileNameId}>{fileName}</span>
+ <Button aria-labelledby={`${deleteLabelId} ${fileNameId}`}>
+ <span id={deleteLabelId}>{deleteLabel}</span>
+ </Button>
+</>
+```
+
+## Associate Descriptions
+
+Use `aria-describedby` to associate concise help or consequences with a named control. The
+referenced content becomes a plain string: headings, lists, and interactive links do not retain
+their structure in the description. Keep rich instructions reachable as normal content or through
+the [Overlay] contract. `aria-details` may supplement structured content where supported; it does
+not replace that reachable content. See [MDN `aria-describedby` guidance][describedby].
+
+In Dify fields, compose `FieldDescription` and `FieldError` with the appropriate label and control.
+These primitives own their relationships, including invalid-state feedback. Do not overwrite them
+with a second label or a competing error association:
+
+```tsx
+<Field name="fileName">
+ <FieldLabel>{fileNameLabel}</FieldLabel>
+ <Input required />
+ <FieldDescription>{formatHint}</FieldDescription>
+ <FieldError match="valueMissing">{requiredMessage}</FieldError>
+</Field>
+```
+
+Use `DialogTitle` and, when useful, `DialogDescription` for a short dialog summary. Do not turn a
+whole form or rich dialog body into one description. Per [Base UI Tooltip guidance], Tooltip is a
+supplemental visual label, not the trigger's accessible-name source. Base UI specifically recommends
+an `aria-label` that closely matches the Tooltip content; apply that to icon-only triggers. When
+persistent visible trigger text already supplies the name, preserve the content-derived name per
+W3C and MDN guidance instead of adding a redundant override merely because Tooltip is present. Use
+[Overlay] choices for essential, structured, interactive, or touch-reachable information.
+
+Prefer descriptions associated with DOM text. When considering `aria-description`, verify target
+browser and assistive-technology behavior. The [AccName 1.2 working draft] gives
+`aria-describedby` precedence over `aria-description`, followed by applicable native description
+sources and unused `title` fallback. It specifies using only the first applicable source, even when
+that source computes to an empty description. Do not stack mechanisms to force repeated output.
+
+## Hidden Text and Safe Removal
+
+- `sr-only` hides text visually while retaining it for assistive technology. It can contribute to
+ a content-derived name or serve as a referenced label or description. A standalone span does not
+ name a sibling control, and `sr-only` is not an automatic replacement for `aria-label`.
+- `hidden`, `display: none`, `visibility: hidden`, and `aria-hidden="true"` normally exclude content
+ during name calculation. Explicitly referenced hidden nodes can still contribute; inspect the
+ reference and its subtree instead of assuming all hidden text is ignored. See the [computation
+ steps][computation] and [description reference][describedby].
+- Before removing a label, inspect the resulting name and description in collapsed navigation,
+ responsive icon-only layouts, loading, and disabled states. CSS truncation alone does not remove
+ underlying text. Preserve primitive relationships and necessary status information. Add hidden
+ text only when information would otherwise be missing.
+- Verify observable names, descriptions, and keyboard behavior at the changed boundary. Follow the
+ test policy owned by that package or consumer. Dify UI changes follow [Package testing]; complex
+ overrides may also require inspecting the rendered accessibility tree and relevant screen-reader
+ behavior.
+
+[APG]: https://www.w3.org/WAI/ARIA/apg/practices/names-and-descriptions#namingtechniques
+[AccName 1.2 working draft]: https://www.w3.org/TR/accname-1.2#mapping_additional_nd_description
+[Base UI Tooltip guidance]: https://base-ui.com/react/components/tooltip#usage-guidelines
+[Base UI accessibility]: https://base-ui.com/react/overview/accessibility
+[Button]: ../src/button/README.md
+[Forms]: forms.md
+[IconButton]: ../src/icon-button/README.md
+[MDN `aria-label` guidance]: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-label
+[Overlay]: overlays.md
+[Package testing]: testing.md
+[accname]: https://www.w3.org/TR/accname-1.2#name_and_description
+[captions]: https://www.w3.org/WAI/ARIA/apg/practices/names-and-descriptions
+[computation]: https://www.w3.org/TR/accname-1.2#computation-steps
+[describedby]: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-describedby
+[html-naming]: https://www.w3.org/TR/html-aria#requirements-for-use-of-aria-attributes-to-name-elements
+[label-in-name]: https://www.w3.org/WAI/WCAG22/Understanding/label-in-name.html
diff --git a/packages/dify-ui/src/button/README.md b/packages/dify-ui/src/button/README.md
index 95c9468e0b0..8ece6c6bdc0 100644
--- a/packages/dify-ui/src/button/README.md
+++ b/packages/dify-ui/src/button/README.md
@@ -119,8 +119,10 @@ for the other variants. Use a `className` override only for a documented layout
## Related guides
- Read [`IconButton`] for icon-only actions.
+- Read [Accessible names and descriptions] when choosing or changing a naming source.
- Read [Base UI Button] for the upstream interaction and composition contract.
+[Accessible names and descriptions]: ../../docs/accessible-names-and-descriptions.md
[Base UI Button]: https://base-ui.com/react/components/button
[WAI-ARIA `aria-busy`]: https://www.w3.org/TR/wai-aria#aria-busy
[`IconButton`]: ../icon-button/README.md
diff --git a/packages/dify-ui/src/icon-button/README.md b/packages/dify-ui/src/icon-button/README.md
index 1d72a9b6865..3e15f5ae641 100644
--- a/packages/dify-ui/src/icon-button/README.md
+++ b/packages/dify-ui/src/icon-button/README.md
@@ -10,8 +10,9 @@ icon-specific appearance, size, and tone variants.
## Accessible name and glyph
Every icon button must provide exactly one accessible-name source: `aria-label` or
-`aria-labelledby`, preserving its [name, role, and value]. A tooltip is a visual enhancement, not
-the button's accessible name.
+`aria-labelledby`, preserving its [name, role, and value]. Follow [Accessible names and
+descriptions] when choosing between those sources. A tooltip is a visual enhancement, not the
+button's accessible name.
Pass exactly one React element containing the decorative glyph and hide that glyph from the
accessibility tree:
@@ -40,8 +41,10 @@ the icon button.
## Related guides
- Read [`Button`] for visible-label actions, submit semantics, and loading state.
+- Read [Accessible names and descriptions] for the cross-component naming and description contract.
- Read [Base UI Button] for the upstream interaction and composition contract.
+[Accessible names and descriptions]: ../../docs/accessible-names-and-descriptions.md
[Base UI Button]: https://base-ui.com/react/components/button
[`Button`]: ../button/README.md
[name, role, and value]: https://www.w3.org/WAI/WCAG22/Understanding/name-role-value.html
diff --git a/web/AGENTS.md b/web/AGENTS.md
index 111d60cdff0..96eee69151d 100644
--- a/web/AGENTS.md
+++ b/web/AGENTS.md
@@ -12,6 +12,7 @@
- Reuse the Web `SearchInput` composite when its search, clear, and IME contract matches the feature; otherwise follow the canonical [Input Group contract].
- Give save and submit flows a real form boundary with visible labels and accessible errors. Use Dify UI `Form` when its structured submission and validation contract is the owner; otherwise use a native form. Follow the canonical [form contract].
- Follow the canonical [Button contract] and [IconButton contract] for action semantics, loading, accessible names, and primitive composition. Do not add a Web wrapper that hides those contracts.
+- Follow [Accessible names and descriptions] when choosing or changing visible labels, ARIA naming, descriptions, or visually hidden text. Web owns localization and feature-specific status announcements; do not redefine the Dify UI naming contract locally.
- Follow the [Dify UI overlay contract] for primitive selection, portals, focus, and layering. Reuse the Web `Infotip` composite for an info glyph that opens explanatory content. Do not introduce a generic Web wrapper that recreates Dify UI overlay behavior.
- For custom SVG icons, follow `../packages/iconify-collections/README.md`; do not add generated React icons under `app/components/base/icons/src/`.
- `docs/test.md` is the single source of truth for Web automated-test policy. Skills may route and execute that policy but must not redefine it.
@@ -26,6 +27,7 @@ This block is written and re-added by `next dev` — verify at `node_modules/nex
<!-- END:nextjs-agent-rules -->
+[Accessible names and descriptions]: ../packages/dify-ui/docs/accessible-names-and-descriptions.md
[Button contract]: ../packages/dify-ui/src/button/README.md
[Dify UI overlay contract]: ../packages/dify-ui/docs/overlays.md
[Dify UI package index]: ../packages/dify-ui/README.md
diff --git a/web/app/components/app-sidebar/dataset-info/__tests__/index.spec.tsx b/web/app/components/app-sidebar/dataset-info/__tests__/index.spec.tsx
index dd31a2787aa..434c824ec11 100644
--- a/web/app/components/app-sidebar/dataset-info/__tests__/index.spec.tsx
+++ b/web/app/components/app-sidebar/dataset-info/__tests__/index.spec.tsx
@@ -211,12 +211,12 @@ describe('DatasetInfo', () => {
expect(screen.queryByText('dataset.chunkingMode.general')).not.toBeInTheDocument()
})
- it('should hide detailed fields when collapsed', () => {
+ it('should keep the dataset name available when collapsed and omit detailed fields', () => {
// Arrange
render(<DatasetInfo expand={false} />)
// Assert
- expect(screen.queryByText('Dataset Name')).not.toBeInTheDocument()
+ expect(screen.getByText('Dataset Name')).toBeInTheDocument()
expect(screen.queryByText('Dataset description')).not.toBeInTheDocument()
})
})
diff --git a/web/app/components/app-sidebar/dataset-info/index.tsx b/web/app/components/app-sidebar/dataset-info/index.tsx
index c71ce99b28d..f10e7a2383f 100644
--- a/web/app/components/app-sidebar/dataset-info/index.tsx
+++ b/web/app/components/app-sidebar/dataset-info/index.tsx
@@ -31,7 +31,6 @@ const DatasetInfo = ({ expand }: DatasetInfoProps) => {
'relative overflow-hidden rounded-xl',
expand ? 'p-2 hover:bg-state-base-hover' : 'flex items-center justify-center px-1 py-1.5',
)}
- aria-label={!expand ? dataset.name : undefined}
>
<div
className={cn(
@@ -47,6 +46,7 @@ const DatasetInfo = ({ expand }: DatasetInfoProps) => {
imageUrl={iconInfo.icon_url}
/>
</div>
+ {!expand && <span className="sr-only">{dataset.name}</span>}
{expand && (
<>
<div className="flex min-w-0 flex-1 flex-col items-start justify-start gap-0.5">
diff --git a/web/app/components/app/configuration/debug/debug-with-multiple-model/__tests__/model-parameter-trigger.spec.tsx b/web/app/components/app/configuration/debug/debug-with-multiple-model/__tests__/model-parameter-trigger.spec.tsx
index 2913542f8ec..edbd7b0f374 100644
--- a/web/app/components/app/configuration/debug/debug-with-multiple-model/__tests__/model-parameter-trigger.spec.tsx
+++ b/web/app/components/app/configuration/debug/debug-with-multiple-model/__tests__/model-parameter-trigger.spec.tsx
@@ -398,39 +398,64 @@ describe('ModelParameterTrigger', () => {
})
it('should render configured model id and incompatible tooltip when model is missing from the provider list', async () => {
+ const user = userEvent.setup()
renderComponent()
expect(screen.getByText('gpt-3.5-turbo')).toBeInTheDocument()
- await userEvent.hover(screen.getByLabelText('common.modelProvider.selector.incompatibleTip'))
+ const trigger = screen.getByRole('button', {
+ name: /common.modelProvider.selector.incompatibleTip/,
+ })
+ await user.hover(trigger)
expect(
- await screen.findByText('common.modelProvider.selector.incompatibleTip'),
+ await screen.findByText(
+ (content, element) =>
+ content === 'common.modelProvider.selector.incompatibleTip' &&
+ !!element &&
+ !trigger.contains(element),
+ ),
).toBeInTheDocument()
})
it('should render configure required tooltip for no-configure status', async () => {
+ const user = userEvent.setup()
mockUseCurrentModel.mockReturnValue({
currentProvider: { provider: 'openai' },
currentModel: { model: 'gpt-3.5-turbo', status: ModelStatusEnum.noConfigure },
})
renderComponent()
- await userEvent.hover(
- screen.getByLabelText('common.modelProvider.selector.configureRequired'),
- )
+ const trigger = screen.getByRole('button', {
+ name: /common.modelProvider.selector.configureRequired/,
+ })
+ await user.hover(trigger)
expect(
- await screen.findByText('common.modelProvider.selector.configureRequired'),
+ await screen.findByText(
+ (content, element) =>
+ content === 'common.modelProvider.selector.configureRequired' &&
+ !!element &&
+ !trigger.contains(element),
+ ),
).toBeInTheDocument()
})
it('should render disabled tooltip for disabled status', async () => {
+ const user = userEvent.setup()
mockUseCurrentModel.mockReturnValue({
currentProvider: { provider: 'openai' },
currentModel: { model: 'gpt-3.5-turbo', status: ModelStatusEnum.disabled },
})
renderComponent()
- await userEvent.hover(screen.getByLabelText('common.modelProvider.selector.disabled'))
- expect(await screen.findByText('common.modelProvider.selector.disabled')).toBeInTheDocument()
+ const trigger = screen.getByRole('button', { name: /common.modelProvider.selector.disabled/ })
+ await user.hover(trigger)
+ expect(
+ await screen.findByText(
+ (content, element) =>
+ content === 'common.modelProvider.selector.disabled' &&
+ !!element &&
+ !trigger.contains(element),
+ ),
+ ).toBeInTheDocument()
})
})
diff --git a/web/app/components/app/configuration/debug/debug-with-multiple-model/model-parameter-trigger.tsx b/web/app/components/app/configuration/debug/debug-with-multiple-model/model-parameter-trigger.tsx
index d9cd7d97572..886b2a41a43 100644
--- a/web/app/components/app/configuration/debug/debug-with-multiple-model/model-parameter-trigger.tsx
+++ b/web/app/components/app/configuration/debug/debug-with-multiple-model/model-parameter-trigger.tsx
@@ -108,10 +108,9 @@ const DebugModelParameterTrigger: FC<DebugModelParameterTriggerProps> = ({
className={`i-ri-arrow-down-s-line size-3 ${isEmpty ? 'text-text-accent' : 'text-text-tertiary'}`}
/>
{statusTooltipLabel && (
- <span
- aria-label={statusTooltipLabel}
- className="i-custom-vender-line-alertsAndFeedback-alert-triangle h-4 w-4 text-[#F79009]"
- />
+ <span className="i-custom-vender-line-alertsAndFeedback-alert-triangle h-4 w-4 text-[#F79009]">
+ <span className="sr-only">{statusTooltipLabel}</span>
+ </span>
)}
</button>
}
diff --git a/web/app/components/app/overview/customize/index.tsx b/web/app/components/app/overview/customize/index.tsx
index b77bcdeb06f..bd148f55819 100644
--- a/web/app/components/app/overview/customize/index.tsx
+++ b/web/app/components/app/overview/customize/index.tsx
@@ -107,9 +107,6 @@ const CustomizeModal: FC<IShareLinkProps> = ({
href={`https://github.com/langgenius/${repository}`}
target="_blank"
rel="noopener noreferrer"
- aria-label={t(($) => $[`${prefixCustomize}.way1.step1Operation`], {
- ns: 'appOverview',
- })}
className={buttonVariants()}
>
<GithubIcon className="text-text-secondary" />
@@ -130,9 +127,6 @@ const CustomizeModal: FC<IShareLinkProps> = ({
href="https://vercel.com/docs/concepts/deployments/git/vercel-for-github"
target="_blank"
rel="noopener noreferrer"
- aria-label={t(($) => $[`${prefixCustomize}.way1.step2Operation`], {
- ns: 'appOverview',
- })}
className={buttonVariants()}
>
<div className="border-t-0 border-r-[7px] border-b-12 border-l-[7px] border-solid border-text-primary border-t-transparent border-r-transparent border-l-transparent"></div>
@@ -173,9 +167,6 @@ const CustomizeModal: FC<IShareLinkProps> = ({
href={apiDocLink}
target="_blank"
rel="noopener noreferrer"
- aria-label={t(($) => $[`${prefixCustomize}.way2.operation`], {
- ns: 'appOverview',
- })}
className={cn(buttonVariants(), 'mt-2')}
>
<span className="text-sm text-text-secondary">
diff --git a/web/app/components/apps/app-sort-filter.tsx b/web/app/components/apps/app-sort-filter.tsx
index 8aaa8c77dbb..be7c96da6b1 100644
--- a/web/app/components/apps/app-sort-filter.tsx
+++ b/web/app/components/apps/app-sort-filter.tsx
@@ -44,10 +44,7 @@ export function AppSortFilter({ value, onChange }: AppSortFilterProps) {
return (
<DropdownMenu>
- <DropdownMenuTrigger
- aria-label={`${sortByLabel} ${activeOption.text}`}
- className="flex h-8 cursor-pointer items-center rounded-lg border-none bg-components-input-bg-normal py-1 pr-2.5 pl-2 text-left whitespace-nowrap outline-hidden hover:bg-state-base-hover focus-visible:ring-2 focus-visible:ring-state-accent-solid data-popup-open:bg-state-base-hover"
- >
+ <DropdownMenuTrigger className="flex h-8 cursor-pointer items-center rounded-lg border-none bg-components-input-bg-normal py-1 pr-2.5 pl-2 text-left whitespace-nowrap outline-hidden hover:bg-state-base-hover focus-visible:ring-2 focus-visible:ring-state-accent-solid data-popup-open:bg-state-base-hover">
<span className="flex items-center gap-1 p-1 text-[13px] leading-4 whitespace-nowrap">
<span className="font-normal text-text-tertiary">{sortByLabel}</span>{' '}
<span className="font-medium text-text-secondary">{activeOption.text}</span>
diff --git a/web/app/components/base/inline-delete-confirm/__tests__/index.spec.tsx b/web/app/components/base/inline-delete-confirm/__tests__/index.spec.tsx
index a8158d334ee..691529c6912 100644
--- a/web/app/components/base/inline-delete-confirm/__tests__/index.spec.tsx
+++ b/web/app/components/base/inline-delete-confirm/__tests__/index.spec.tsx
@@ -47,16 +47,15 @@ describe('InlineDeleteConfirm', () => {
expect(getByText('Confirm')).toBeInTheDocument()
})
- it('should have proper ARIA attributes', () => {
+ it('should expose the prompt title and description on a semantic group', () => {
const onConfirm = vi.fn()
const onCancel = vi.fn()
- const { container } = render(
+ const { getByRole } = render(
<InlineDeleteConfirm onConfirm={onConfirm} onCancel={onCancel} />,
)
- const wrapper = container.firstChild as HTMLElement
- expect(wrapper).toHaveAttribute('aria-labelledby', 'inline-delete-confirm-title')
- expect(wrapper).toHaveAttribute('aria-describedby', 'inline-delete-confirm-description')
+ const prompt = getByRole('group', { name: 'Delete?' })
+ expect(prompt).toHaveAccessibleDescription('Please confirm your action.')
})
})
diff --git a/web/app/components/base/inline-delete-confirm/index.tsx b/web/app/components/base/inline-delete-confirm/index.tsx
index 850c2990f91..bc9e1258527 100644
--- a/web/app/components/base/inline-delete-confirm/index.tsx
+++ b/web/app/components/base/inline-delete-confirm/index.tsx
@@ -2,6 +2,7 @@
import type { FC } from 'react'
import { Button } from '@langgenius/dify-ui/button'
import { cn } from '@langgenius/dify-ui/cn'
+import { useId } from 'react'
import { useTranslation } from 'react-i18next'
type InlineDeleteConfirmProps = {
@@ -24,6 +25,8 @@ const InlineDeleteConfirm: FC<InlineDeleteConfirmProps> = ({
variant = 'delete',
}) => {
const { t } = useTranslation()
+ const titleId = useId()
+ const descriptionId = useId()
const titleText =
title || t(($) => $['operation.deleteConfirmTitle'], { ns: 'common', defaultValue: 'Delete?' })
@@ -33,8 +36,9 @@ const InlineDeleteConfirm: FC<InlineDeleteConfirmProps> = ({
return (
<div
- aria-labelledby="inline-delete-confirm-title"
- aria-describedby="inline-delete-confirm-description"
+ role="group"
+ aria-labelledby={titleId}
+ aria-describedby={descriptionId}
className={cn(
'flex w-30 flex-col justify-center gap-1.5',
'rounded-[10px] border-[0.5px] border-components-panel-border-subtle',
@@ -44,18 +48,12 @@ const InlineDeleteConfirm: FC<InlineDeleteConfirmProps> = ({
className,
)}
>
- <div id="inline-delete-confirm-title" className="system-xs-semibold text-text-primary">
+ <div id={titleId} className="system-xs-semibold text-text-primary">
{titleText}
</div>
<div className="flex w-full items-center justify-center gap-1">
- <Button
- size="small"
- variant="secondary"
- onClick={onCancel}
- aria-label={cancelTxt}
- className="flex-1"
- >
+ <Button size="small" variant="secondary" onClick={onCancel} className="flex-1">
{cancelTxt}
</Button>
<Button
@@ -63,14 +61,13 @@ const InlineDeleteConfirm: FC<InlineDeleteConfirmProps> = ({
variant="primary"
tone={variant === 'delete' ? 'destructive' : 'default'}
onClick={onConfirm}
- aria-label={confirmTxt}
className="flex-1"
>
{confirmTxt}
</Button>
</div>
- <span id="inline-delete-confirm-description" className="sr-only">
+ <span id={descriptionId} className="sr-only">
{t(($) => $['operation.confirmAction'], {
ns: 'common',
defaultValue: 'Please confirm your action.',
diff --git a/web/app/components/datasets/create/embedding-process/__tests__/indexing-progress-item.spec.tsx b/web/app/components/datasets/create/embedding-process/__tests__/indexing-progress-item.spec.tsx
index fa85e99a23c..825fe39e3ab 100644
--- a/web/app/components/datasets/create/embedding-process/__tests__/indexing-progress-item.spec.tsx
+++ b/web/app/components/datasets/create/embedding-process/__tests__/indexing-progress-item.spec.tsx
@@ -93,7 +93,18 @@ describe('IndexingProgressItem', () => {
/>,
)
- expect(screen.getByLabelText('Parse failed')).toBeInTheDocument()
+ expect(screen.getByText('Parse failed')).toBeInTheDocument()
+ })
+
+ it('should use the localized fallback when an error has no message', () => {
+ render(
+ <IndexingProgressItem
+ detail={makeDetail({ indexing_status: 'error', error: null })}
+ name="broken.pdf"
+ />,
+ )
+
+ expect(screen.getByText('common.error')).toBeInTheDocument()
})
it('should show priority label when billing is enabled', () => {
diff --git a/web/app/components/datasets/create/embedding-process/indexing-progress-item.tsx b/web/app/components/datasets/create/embedding-process/indexing-progress-item.tsx
index be57451e50b..571a8ced063 100644
--- a/web/app/components/datasets/create/embedding-process/indexing-progress-item.tsx
+++ b/web/app/components/datasets/create/embedding-process/indexing-progress-item.tsx
@@ -3,6 +3,7 @@ import type { IndexingStatusResponse } from '@/models/datasets'
import { cn } from '@langgenius/dify-ui/cn'
import { Tooltip, TooltipContent, TooltipTrigger } from '@langgenius/dify-ui/tooltip'
import { RiCheckboxCircleFill, RiErrorWarningFill } from '@remixicon/react'
+import { useTranslation } from 'react-i18next'
import NotionIcon from '@/app/components/base/notion-icon'
import PriorityLabel from '@/app/components/billing/priority-label'
import { DataSourceType } from '@/models/datasets'
@@ -19,20 +20,25 @@ type IndexingProgressItemProps = {
// Status icon component for completed/error states
const StatusIcon: FC<{ status: string; error?: string }> = ({ status, error }) => {
+ const { t } = useTranslation()
+
if (status === 'completed')
return <RiCheckboxCircleFill className="size-4 shrink-0 text-text-success" />
if (status === 'error') {
+ const errorLabel = error || t(($) => $.error, { ns: 'common' })
+
return (
<Tooltip>
- <TooltipTrigger render={<span aria-label={error || 'Error'} />}>
- <RiErrorWarningFill className="size-4 shrink-0 text-text-destructive" />
+ <TooltipTrigger render={<span />}>
+ <RiErrorWarningFill aria-hidden className="size-4 shrink-0 text-text-destructive" />
+ <span className="sr-only">{errorLabel}</span>
</TooltipTrigger>
<TooltipContent
sideOffset={4}
className="max-w-60 rounded-xl border-[0.5px] border-components-panel-border px-4 py-3.5 body-xs-regular text-text-secondary"
>
- {error}
+ {errorLabel}
</TooltipContent>
</Tooltip>
)
diff --git a/web/app/components/datasets/metadata/metadata-dataset/dataset-metadata-picker.tsx b/web/app/components/datasets/metadata/metadata-dataset/dataset-metadata-picker.tsx
index e7a16969720..f3b5c6b121c 100644
--- a/web/app/components/datasets/metadata/metadata-dataset/dataset-metadata-picker.tsx
+++ b/web/app/components/datasets/metadata/metadata-dataset/dataset-metadata-picker.tsx
@@ -107,12 +107,7 @@ export function DatasetMetadataPicker({
<Popover open={open} onOpenChange={setOpen} onOpenChangeComplete={handleOpenChangeComplete}>
<PopoverTrigger
render={
- <Button
- variant="tertiary"
- size="small"
- aria-label={t(($) => $['metadata.addMetadata'], { ns: 'dataset' })}
- className="w-full px-2 py-0"
- >
+ <Button variant="tertiary" size="small" className="w-full px-2 py-0">
<span className="flex min-w-0 items-center justify-center gap-1">
<span
className="i-ri-add-line size-3.5 shrink-0 text-components-button-tertiary-text"
diff --git a/web/app/components/header/account-setting/model-provider-page/model-selector/__tests__/popup-item.spec.tsx b/web/app/components/header/account-setting/model-provider-page/model-selector/__tests__/popup-item.spec.tsx
index 848b07740c1..2385839216b 100644
--- a/web/app/components/header/account-setting/model-provider-page/model-selector/__tests__/popup-item.spec.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/model-selector/__tests__/popup-item.spec.tsx
@@ -270,7 +270,8 @@ describe('PopupItem', () => {
expect(screen.getByText('GPT-4')).toHaveClass('text-text-quaternary')
})
- it('should render suggestion icon with tooltip for suggested models', async () => {
+ it('should expose the suggestion in the model name and on hover', async () => {
+ const user = userEvent.setup()
renderPopupItem(
<PopupItem
{...previewCardProps()}
@@ -287,14 +288,24 @@ describe('PopupItem', () => {
expect(screen.getByText('GPT-5.5')).toBeInTheDocument()
expect(screen.getByText('GPT-5')).toBeInTheDocument()
- const suggestionIcon = screen.getByLabelText('common.modelProvider.selector.suggestionTip')
+ const modelButton = screen.getByRole('button', {
+ name: /GPT-5\.5.*common.modelProvider.selector.suggestionTip/,
+ })
+ const suggestionText = screen.getByText('common.modelProvider.selector.suggestionTip')
+ const suggestionIndicator = suggestionText.parentElement
- expect(suggestionIcon).toHaveClass('i-ri-shield-star-line')
+ expect(modelButton).toBeInTheDocument()
+ expect(suggestionIndicator).not.toBeNull()
- await userEvent.hover(suggestionIcon)
+ await user.hover(suggestionIndicator!)
expect(
- await screen.findByText('common.modelProvider.selector.suggestionTip'),
+ await screen.findByText(
+ (content, element) =>
+ content === 'common.modelProvider.selector.suggestionTip' &&
+ !!element &&
+ !modelButton.contains(element),
+ ),
).toBeInTheDocument()
})
diff --git a/web/app/components/header/account-setting/model-provider-page/model-selector/popup-item.tsx b/web/app/components/header/account-setting/model-provider-page/model-selector/popup-item.tsx
index 8c36c943331..c5181b7b401 100644
--- a/web/app/components/header/account-setting/model-provider-page/model-selector/popup-item.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/model-selector/popup-item.tsx
@@ -241,10 +241,9 @@ function PopupItem({
<Tooltip>
<TooltipTrigger
render={
- <span
- aria-label={suggestionTip}
- className="i-ri-shield-star-line size-3.5 shrink-0 text-text-accent-secondary"
- />
+ <span className="i-ri-shield-star-line size-3.5 shrink-0 text-text-accent-secondary">
+ <span className="sr-only">{suggestionTip}</span>
+ </span>
}
/>
<TooltipContent placement="top">{suggestionTip}</TooltipContent>
diff --git a/web/app/components/integrations/index.tsx b/web/app/components/integrations/index.tsx
index 3eae9afbaeb..9a4f5bcbe55 100644
--- a/web/app/components/integrations/index.tsx
+++ b/web/app/components/integrations/index.tsx
@@ -291,7 +291,6 @@ export default function IntegrationsPage({
/>
<Collapsible open={isToolsExpanded} onOpenChange={handleToolsOpenChange}>
<CollapsibleTrigger
- aria-label={t(($) => $['menus.tools'], { ns: 'common' })}
className={cn(
toolsNavItemClassName,
'border-none bg-transparent data-panel-open:text-components-menu-item-text',
diff --git a/web/app/components/integrations/sidebar-actions.tsx b/web/app/components/integrations/sidebar-actions.tsx
index d4269a0d0d7..d5552496f24 100644
--- a/web/app/components/integrations/sidebar-actions.tsx
+++ b/web/app/components/integrations/sidebar-actions.tsx
@@ -40,8 +40,9 @@ function PermissionTooltipWrapper({
show,
}: PermissionTooltipWrapperProps) {
const trigger = (
- <span aria-label={show ? content : undefined} className={cn('inline-flex', className)}>
+ <span className={cn('inline-flex', className)}>
{children}
+ {show && <span className="sr-only">{content}</span>}
</span>
)
@@ -166,11 +167,7 @@ export function IntegrationSidebarUtilityActions({
<Popover>
<PopoverTrigger
render={
- <Button
- variant="ghost"
- className={sidebarUtilityActionClassName}
- aria-label={permissionsLabel}
- >
+ <Button variant="ghost" className={sidebarUtilityActionClassName}>
<span aria-hidden className="flex size-5 shrink-0 items-center justify-center">
<span className="i-ri-equalizer-2-line size-4" />
</span>
diff --git a/web/app/components/integrations/sidebar-nav-item.tsx b/web/app/components/integrations/sidebar-nav-item.tsx
index 31f72a20544..17e312ee563 100644
--- a/web/app/components/integrations/sidebar-nav-item.tsx
+++ b/web/app/components/integrations/sidebar-nav-item.tsx
@@ -70,7 +70,6 @@ export function IntegrationSidebarNavItem({
if (!item.section) {
return (
<div
- aria-label={item.label}
className={cn(
integrationSidebarNavItemClassName,
integrationSidebarDisabledNavItemClassName,
@@ -105,7 +104,6 @@ export function IntegrationSidebarNavItem({
return (
<button
type="button"
- aria-label={item.label}
aria-pressed={isActive}
className={cn('border-none bg-transparent', className)}
onClick={() => onSelect(item.section!)}
@@ -119,7 +117,6 @@ export function IntegrationSidebarNavItem({
return (
<Link
href={buildIntegrationPath(item.section)}
- aria-label={item.label}
aria-current={isActive ? 'page' : undefined}
className={className}
>
diff --git a/web/app/components/plugins/base/badges/__tests__/icon-with-tooltip.spec.tsx b/web/app/components/plugins/base/badges/__tests__/icon-with-tooltip.spec.tsx
index ed2f079e97e..6353587d2e7 100644
--- a/web/app/components/plugins/base/badges/__tests__/icon-with-tooltip.spec.tsx
+++ b/web/app/components/plugins/base/badges/__tests__/icon-with-tooltip.spec.tsx
@@ -23,7 +23,7 @@ describe('IconWithTooltip', () => {
expect(screen.queryByText('Light icon')).not.toBeInTheDocument()
})
- it('exposes tooltip content as the icon accessible name', () => {
+ it('exposes the badge meaning without opening the tooltip', () => {
render(
<IconWithTooltip
theme={Theme.light}
@@ -33,6 +33,6 @@ describe('IconWithTooltip', () => {
/>,
)
- expect(screen.getByLabelText('Partner plugin')).toBeInTheDocument()
+ expect(screen.getByText('Partner plugin')).toBeInTheDocument()
})
})
diff --git a/web/app/components/plugins/base/badges/icon-with-tooltip.tsx b/web/app/components/plugins/base/badges/icon-with-tooltip.tsx
index 8c8f2bc8c6f..0f3a560db5b 100644
--- a/web/app/components/plugins/base/badges/icon-with-tooltip.tsx
+++ b/web/app/components/plugins/base/badges/icon-with-tooltip.tsx
@@ -23,8 +23,9 @@ const IconWithTooltip: FC<IconWithTooltipProps> = ({
const iconClassName = cn('size-5', className)
const Icon = isDark ? BadgeIconDark : BadgeIconLight
const icon = (
- <span aria-label={popupContent} className="flex shrink-0 items-center justify-center">
- <Icon className={iconClassName} />
+ <span className="flex shrink-0 items-center justify-center">
+ <Icon aria-hidden={!!popupContent} className={iconClassName} />
+ {popupContent && <span className="sr-only">{popupContent}</span>}
</span>
)
diff --git a/web/app/components/plugins/plugin-auth/authorize/permission-selector.tsx b/web/app/components/plugins/plugin-auth/authorize/permission-selector.tsx
index 79c47e357ab..0e5b636d59f 100644
--- a/web/app/components/plugins/plugin-auth/authorize/permission-selector.tsx
+++ b/web/app/components/plugins/plugin-auth/authorize/permission-selector.tsx
@@ -98,7 +98,6 @@ const PermissionSelector = ({ disabled, permission, onChange }: PermissionSelect
<DropdownMenuRadioItemIndicator />
</DropdownMenuRadioItem>
<DropdownMenuRadioItem<CredentialPermission>
- aria-label={allTeamMembersLabel}
value={PermissionLevel.allTeamMembers}
closeOnClick
className="touch-manipulation"
diff --git a/web/app/components/plugins/plugin-detail-panel/detail-header/components/__tests__/plugin-source-badge.spec.tsx b/web/app/components/plugins/plugin-detail-panel/detail-header/components/__tests__/plugin-source-badge.spec.tsx
index fd85bc55305..1955a7d7392 100644
--- a/web/app/components/plugins/plugin-detail-panel/detail-header/components/__tests__/plugin-source-badge.spec.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/detail-header/components/__tests__/plugin-source-badge.spec.tsx
@@ -12,6 +12,6 @@ describe('PluginSourceBadge', () => {
])('labels the %s source badge', (source, label) => {
render(<PluginSourceBadge source={source} />)
- expect(screen.getByLabelText(label)).toBeInTheDocument()
+ expect(screen.getByText(label)).toBeInTheDocument()
})
})
diff --git a/web/app/components/plugins/plugin-detail-panel/detail-header/components/plugin-source-badge.tsx b/web/app/components/plugins/plugin-detail-panel/detail-header/components/plugin-source-badge.tsx
index d34231b827d..7f531f34a99 100644
--- a/web/app/components/plugins/plugin-detail-panel/detail-header/components/plugin-source-badge.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/detail-header/components/plugin-source-badge.tsx
@@ -54,8 +54,11 @@ const PluginSourceBadge: FC<PluginSourceBadgeProps> = ({ source }) => {
<Tooltip>
<TooltipTrigger
render={
- <span aria-label={tip} className="inline-flex">
- {config.icon}
+ <span className="inline-flex">
+ <span aria-hidden className="inline-flex">
+ {config.icon}
+ </span>
+ <span className="sr-only">{tip}</span>
</span>
}
/>
diff --git a/web/app/components/plugins/plugin-detail-panel/operation-dropdown.tsx b/web/app/components/plugins/plugin-detail-panel/operation-dropdown.tsx
index 67b6286763c..23ffc52047a 100644
--- a/web/app/components/plugins/plugin-detail-panel/operation-dropdown.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/operation-dropdown.tsx
@@ -113,7 +113,6 @@ export function OperationDropdown({
href={detailUrl}
target="_blank"
rel="noopener noreferrer"
- aria-label={t(($) => $['detailPanel.operation.viewDetail'], { ns: 'plugin' })}
>
<span className="min-w-0 grow truncate px-1 py-0.5">
{t(($) => $['detailPanel.operation.viewDetail'], { ns: 'plugin' })}
diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/subscription-card.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/subscription-card.tsx
index ce7bbee8008..b34cd00a623 100644
--- a/web/app/components/plugins/plugin-detail-panel/subscription-list/subscription-card.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/subscription-card.tsx
@@ -60,7 +60,6 @@ const SubscriptionCard = ({ data, pluginDetail }: Props) => {
<Popover>
<PopoverTrigger
openOnHover
- aria-label={data.endpoint}
className="flex-1 truncate border-0 bg-transparent p-0 text-left system-xs-regular text-text-tertiary"
>
{data.endpoint}
diff --git a/web/app/components/plugins/plugin-page/category-empty-state.tsx b/web/app/components/plugins/plugin-page/category-empty-state.tsx
index 76e86907445..03e9f587869 100644
--- a/web/app/components/plugins/plugin-page/category-empty-state.tsx
+++ b/web/app/components/plugins/plugin-page/category-empty-state.tsx
@@ -55,7 +55,6 @@ const CategoryEmptyState = ({
components={{
marketplace: (
<a
- aria-label={t(($) => $['marketplace.difyMarketplace'], { ns: 'plugin' })}
className="system-xs-medium text-text-accent hover:underline"
href={`#${getCategoryMarketplaceId(category)}`}
>
diff --git a/web/app/components/plugins/plugin-page/install-plugin-dropdown.tsx b/web/app/components/plugins/plugin-page/install-plugin-dropdown.tsx
index 30c8e6c9526..64350631e66 100644
--- a/web/app/components/plugins/plugin-page/install-plugin-dropdown.tsx
+++ b/web/app/components/plugins/plugin-page/install-plugin-dropdown.tsx
@@ -166,7 +166,6 @@ const InstallPluginDropdown = ({
variant={triggerVariant}
disabled={disabled}
title={buttonLabel}
- aria-label={buttonLabel}
className={cn(
'size-full p-2',
triggerClassName,
diff --git a/web/app/components/snippets/components/snippet-collapsed-preview.tsx b/web/app/components/snippets/components/snippet-collapsed-preview.tsx
index 04f5b02eb63..503f8fc9df0 100644
--- a/web/app/components/snippets/components/snippet-collapsed-preview.tsx
+++ b/web/app/components/snippets/components/snippet-collapsed-preview.tsx
@@ -20,10 +20,7 @@ export function SnippetCollapsedPreview({
const sectionLabel = t(($) => $.sectionOrchestrate, { ns: 'snippet' })
return (
- <div
- className="flex min-h-0 grow flex-col items-center px-2"
- aria-label="Snippet collapsed preview"
- >
+ <div className="flex min-h-0 grow flex-col items-center px-2">
<div className="mb-3.5 flex w-full shrink-0 justify-center px-3.5 pt-0.5 pb-0.75">
<div className="my-0 h-px w-6.75 shrink-0 bg-divider-subtle" data-testid="divider"></div>
</div>
@@ -38,13 +35,11 @@ export function SnippetCollapsedPreview({
iconMap={{ selected: NodeTreeIcon, normal: NodeTreeIcon }}
/>
) : (
- <div
- aria-label={sectionLabel}
- className="flex size-8 items-center justify-center rounded-lg border-t-[0.75px] border-r-[0.25px] border-b-[0.25px] border-l-[0.75px] border-effects-highlight-lightmode-off bg-components-menu-item-bg-active p-1.5 text-text-accent-light-mode-only"
- >
+ <div className="flex size-8 items-center justify-center rounded-lg border-t-[0.75px] border-r-[0.25px] border-b-[0.25px] border-l-[0.75px] border-effects-highlight-lightmode-off bg-components-menu-item-bg-active p-1.5 text-text-accent-light-mode-only">
<div className="flex size-5 items-center justify-center">
<NodeTreeIcon className="size-4.5 shrink-0" />
</div>
+ <span className="sr-only">{sectionLabel}</span>
</div>
)}
<div
@@ -52,9 +47,9 @@ export function SnippetCollapsedPreview({
'mt-4 flex min-w-6 items-center justify-center rounded-full border border-divider-subtle bg-components-badge-bg-gray-soft px-2 text-2xs leading-4 font-normal text-text-secondary',
inputFieldCount > 99 ? 'h-5' : 'size-5',
)}
- aria-label={`${inputFieldCount} ${t(($) => $.inputVariables, { ns: 'snippet' })}`}
>
{inputFieldCount}
+ <span className="sr-only"> {t(($) => $.inputVariables, { ns: 'snippet' })}</span>
</div>
</div>
)
diff --git a/web/app/components/tools/mcp/create-card.tsx b/web/app/components/tools/mcp/create-card.tsx
index 49f4f848491..978177d705f 100644
--- a/web/app/components/tools/mcp/create-card.tsx
+++ b/web/app/components/tools/mcp/create-card.tsx
@@ -49,7 +49,6 @@ export function NewMCPButton({ handleCreate }: Props) {
data-step-by-step-tour-target={STEP_BY_STEP_TOUR_TARGETS.integrationMcpAdd}
onClick={() => setShowModal(true)}
title={addMCPServerLabel}
- aria-label={addMCPServerLabel}
>
<span aria-hidden className="i-ri-add-line size-4 shrink-0" />
{addMCPServerLabel}
diff --git a/web/app/components/tools/mcp/detail/__tests__/content.spec.tsx b/web/app/components/tools/mcp/detail/__tests__/content.spec.tsx
index 735dbffdced..4359bd4c2cc 100644
--- a/web/app/components/tools/mcp/detail/__tests__/content.spec.tsx
+++ b/web/app/components/tools/mcp/detail/__tests__/content.spec.tsx
@@ -501,8 +501,9 @@ describe('MCPDetailContent', () => {
const { default: copy } = await import('copy-to-clipboard')
render(<MCPDetailContent {...defaultProps} />, { wrapper: createWrapper() })
- // Find the server identifier element
- const serverIdentifier = screen.getByText('test-mcp')
+ const serverIdentifier = screen.getByRole('button', {
+ name: /test-mcp.*tools\.mcp\.identifier/,
+ })
fireEvent.click(serverIdentifier)
expect(copy).toHaveBeenCalledWith('test-mcp')
diff --git a/web/app/components/tools/mcp/detail/content.tsx b/web/app/components/tools/mcp/detail/content.tsx
index 3ccfeb9b947..447deb7bb9f 100644
--- a/web/app/components/tools/mcp/detail/content.tsx
+++ b/web/app/components/tools/mcp/detail/content.tsx
@@ -150,11 +150,11 @@ const MCPDetailContent: FC<Props> = ({
type="button"
variant="ghost"
size="small"
- aria-label={identifierLabel}
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"
onClick={() => copy(detail.server_identifier || '')}
>
{detail.server_identifier}
+ <span className="sr-only"> {identifierLabel}</span>
</Button>
}
/>
@@ -164,10 +164,8 @@ const MCPDetailContent: FC<Props> = ({
<Tooltip>
<TooltipTrigger
render={
- <div
- aria-label={serverUrlLabel}
- className="truncate system-xs-regular text-text-secondary"
- >
+ <div className="truncate system-xs-regular text-text-secondary">
+ <span className="sr-only">{`${serverUrlLabel}: `}</span>
{detail.server_url}
</div>
}
diff --git a/web/app/components/tools/provider/create-entry-card.tsx b/web/app/components/tools/provider/create-entry-card.tsx
index 07c879ba077..9ec6e114c3e 100644
--- a/web/app/components/tools/provider/create-entry-card.tsx
+++ b/web/app/components/tools/provider/create-entry-card.tsx
@@ -29,7 +29,6 @@ const CreateEntryCard = ({
>
<button
type="button"
- aria-label={title}
title={title}
className="group flex h-21 w-full cursor-pointer items-center gap-3 p-4 text-left outline-hidden hover:bg-components-panel-on-panel-item-bg-hover focus-visible:ring-1 focus-visible:ring-components-input-border-hover"
onClick={onCreate}
@@ -52,7 +51,6 @@ const CreateEntryCard = ({
href={linkUrl}
target="_blank"
rel="noopener noreferrer"
- aria-label={linkText}
title={linkText}
className="flex h-8 items-center gap-0.5 border-t border-divider-subtle px-3 py-2 text-components-button-secondary-text outline-hidden hover:bg-components-panel-on-panel-item-bg-hover hover:text-text-accent focus-visible:ring-1 focus-visible:ring-components-input-border-hover"
>
diff --git a/web/app/components/tools/provider/custom-create-card.tsx b/web/app/components/tools/provider/custom-create-card.tsx
index 1d808266abb..cdd0a3f4869 100644
--- a/web/app/components/tools/provider/custom-create-card.tsx
+++ b/web/app/components/tools/provider/custom-create-card.tsx
@@ -56,7 +56,6 @@ export const NewCustomToolButton = ({ onRefreshData }: Props) => {
className="px-3!"
onClick={() => setIsShowEditCustomCollectionModal(true)}
title={addSwaggerAPIAsToolLabel}
- aria-label={addSwaggerAPIAsToolLabel}
>
<span aria-hidden className="i-ri-add-line size-4 shrink-0" />
{addSwaggerAPIAsToolLabel}
diff --git a/web/app/components/tools/provider/detail.tsx b/web/app/components/tools/provider/detail.tsx
index b6aaf76bcdb..d9c8b13087f 100644
--- a/web/app/components/tools/provider/detail.tsx
+++ b/web/app/components/tools/provider/detail.tsx
@@ -340,7 +340,6 @@ const ProviderDetail = ({ collection, onHide, onRefreshData }: Props) => {
href={`${basePath}/app/${(customCollection as WorkflowToolProviderResponse).workflow_app_id}/workflow`}
rel="noreferrer"
target="_blank"
- aria-label={t(($) => $.openInStudio, { ns: 'tools' })}
className={cn(
buttonVariants({ variant: 'primary' }),
'my-3 h-8 min-w-0 flex-1 rounded-lg py-2',
diff --git a/web/app/components/workflow/header/view-history.tsx b/web/app/components/workflow/header/view-history.tsx
index 0825f7cd8d7..4e48bfa6c0e 100644
--- a/web/app/components/workflow/header/view-history.tsx
+++ b/web/app/components/workflow/header/view-history.tsx
@@ -43,7 +43,6 @@ const ViewHistory = ({ withText, onClearLogAndMessageModal, historyUrl }: ViewHi
render={
<button
type="button"
- aria-label={t(($) => $['common.showRunHistory'], { ns: 'workflow' })}
className={cn(
'flex h-8 items-center rounded-lg border-[0.5px] border-components-button-secondary-border bg-components-button-secondary-bg px-3 shadow-xs',
'cursor-pointer text-[13px] font-medium text-components-button-secondary-text hover:bg-components-button-secondary-bg-hover',
diff --git a/web/app/components/workflow/nodes/agent-v2/components/__tests__/agent-orchestrate-panel-content.spec.tsx b/web/app/components/workflow/nodes/agent-v2/components/__tests__/agent-orchestrate-panel-content.spec.tsx
index 3e159a17671..33384fc5319 100644
--- a/web/app/components/workflow/nodes/agent-v2/components/__tests__/agent-orchestrate-panel-content.spec.tsx
+++ b/web/app/components/workflow/nodes/agent-v2/components/__tests__/agent-orchestrate-panel-content.spec.tsx
@@ -894,7 +894,7 @@ describe('WorkflowInlineAgentConfigureWorkspace', () => {
expect(
screen.queryByRole('button', {
- name: 'agentV2.agentDetail.configure.workingDirectory.open',
+ name: 'agentV2.agentDetail.configure.workingDirectory.fileSystem',
}),
).not.toBeInTheDocument()
@@ -910,7 +910,7 @@ describe('WorkflowInlineAgentConfigureWorkspace', () => {
)
expect(
screen.queryByRole('button', {
- name: 'agentV2.agentDetail.configure.workingDirectory.open',
+ name: 'agentV2.agentDetail.configure.workingDirectory.fileSystem',
}),
).not.toBeInTheDocument()
@@ -921,13 +921,13 @@ describe('WorkflowInlineAgentConfigureWorkspace', () => {
)
expect(
screen.getByRole('button', {
- name: 'agentV2.agentDetail.configure.workingDirectory.open',
+ name: 'agentV2.agentDetail.configure.workingDirectory.fileSystem',
}),
).toBeInTheDocument()
fireEvent.click(
await screen.findByRole('button', {
- name: 'agentV2.agentDetail.configure.workingDirectory.open',
+ name: 'agentV2.agentDetail.configure.workingDirectory.fileSystem',
}),
)
diff --git a/web/app/components/workflow/nodes/agent-v2/components/agent-output-variables/edit-card.tsx b/web/app/components/workflow/nodes/agent-v2/components/agent-output-variables/edit-card.tsx
index 488f7ae79fc..6cc0cd080bb 100644
--- a/web/app/components/workflow/nodes/agent-v2/components/agent-output-variables/edit-card.tsx
+++ b/web/app/components/workflow/nodes/agent-v2/components/agent-output-variables/edit-card.tsx
@@ -119,9 +119,6 @@ export function OutputEditCard({
<Field name="required" className="contents">
<FieldLabel className="flex h-6 items-center gap-x-1 system-xs-regular text-text-tertiary">
<Switch
- aria-label={t(($) => $['nodes.agent.outputVars.requiredLabel'], {
- ns: 'workflow',
- })}
size="xs"
checked={draft.required}
onCheckedChange={(required) => updateDraft({ required })}
@@ -195,13 +192,7 @@ export function OutputEditCard({
<Button type="button" size="small" variant="secondary" onClick={onCancel}>
{t(($) => $['operation.cancel'], { ns: 'common' })}
</Button>
- <Button
- type="submit"
- size="small"
- variant="primary"
- disabled={confirmDisabled}
- aria-label={t(($) => $['nodes.agent.outputVars.confirm'], { ns: 'workflow' })}
- >
+ <Button type="submit" size="small" variant="primary" disabled={confirmDisabled}>
{t(($) => $['nodes.agent.outputVars.confirm'], { ns: 'workflow' })}
<ConfirmHotkeyHint />
</Button>
diff --git a/web/app/components/workflow/nodes/agent/components/__tests__/model-bar.spec.tsx b/web/app/components/workflow/nodes/agent/components/__tests__/model-bar.spec.tsx
index 46f450684db..da370451599 100644
--- a/web/app/components/workflow/nodes/agent/components/__tests__/model-bar.spec.tsx
+++ b/web/app/components/workflow/nodes/agent/components/__tests__/model-bar.spec.tsx
@@ -54,7 +54,7 @@ describe('agent/model-bar', () => {
expect(emptySelector).toBeInTheDocument()
expect(screen.getByText('indicator:error')).toBeInTheDocument()
- expect(screen.getByLabelText('workflow.nodes.agent.modelNotSelected')).toBeInTheDocument()
+ expect(screen.getByText('workflow.nodes.agent.modelNotSelected')).toBeInTheDocument()
})
it('should render the selected model without warning when it is installed', () => {
@@ -69,6 +69,6 @@ describe('agent/model-bar', () => {
expect(screen.getByText('openai/gpt-4.1:1')).toBeInTheDocument()
expect(screen.getByText('indicator:error')).toBeInTheDocument()
- expect(screen.getByLabelText('workflow.nodes.agent.modelNotInstallTooltip')).toBeInTheDocument()
+ expect(screen.getByText('workflow.nodes.agent.modelNotInstallTooltip')).toBeInTheDocument()
})
})
diff --git a/web/app/components/workflow/nodes/agent/components/__tests__/tool-icon.spec.tsx b/web/app/components/workflow/nodes/agent/components/__tests__/tool-icon.spec.tsx
index 465b4517e11..65a4f687f37 100644
--- a/web/app/components/workflow/nodes/agent/components/__tests__/tool-icon.spec.tsx
+++ b/web/app/components/workflow/nodes/agent/components/__tests__/tool-icon.spec.tsx
@@ -93,7 +93,7 @@ describe('agent/tool-icon', () => {
expect(screen.getByText('indicator:warning')).toBeInTheDocument()
expect(
- screen.getByLabelText('workflow.nodes.agent.toolNotAuthorizedTooltip:{"tool":"tool-b"}'),
+ screen.getByText('workflow.nodes.agent.toolNotAuthorizedTooltip:{"tool":"tool-b"}'),
).toBeInTheDocument()
mockWorkflowTools = []
@@ -104,7 +104,7 @@ describe('agent/tool-icon', () => {
expect(marketplaceIcon).toHaveAttribute('src', 'https://example.com/market-tool.png')
expect(screen.getByText('indicator:error')).toBeInTheDocument()
expect(
- screen.getByLabelText('workflow.nodes.agent.toolNotInstallTooltip:{"tool":"tool-c"}'),
+ screen.getByText('workflow.nodes.agent.toolNotInstallTooltip:{"tool":"tool-c"}'),
).toBeInTheDocument()
})
diff --git a/web/app/components/workflow/nodes/agent/components/model-bar.tsx b/web/app/components/workflow/nodes/agent/components/model-bar.tsx
index b82e1847af1..e8c38cdb3ad 100644
--- a/web/app/components/workflow/nodes/agent/components/model-bar.tsx
+++ b/web/app/components/workflow/nodes/agent/components/model-bar.tsx
@@ -47,7 +47,7 @@ export const ModelBar: FC<ModelBarProps> = (props) => {
<Tooltip>
<TooltipTrigger
render={
- <div className="relative" aria-label={tooltip}>
+ <div className="relative">
<ModelSelector
models={[]}
value={undefined}
@@ -57,6 +57,7 @@ export const ModelBar: FC<ModelBarProps> = (props) => {
disabled
/>
<StatusDot status="error" className="absolute -top-0.5 -right-0.5" />
+ <span className="sr-only">{tooltip}</span>
</div>
}
/>
@@ -76,7 +77,7 @@ export const ModelBar: FC<ModelBarProps> = (props) => {
ns: 'workflow',
})
const modelSelector = (
- <div className="relative" aria-label={showWarn ? modelNotInstalledTooltip : undefined}>
+ <div className="relative">
<ModelSelector
models={modelList}
value={{
@@ -89,6 +90,7 @@ export const ModelBar: FC<ModelBarProps> = (props) => {
disabled
/>
{showWarn && <StatusDot status="error" className="absolute -top-0.5 -right-0.5" />}
+ {showWarn && <span className="sr-only">{modelNotInstalledTooltip}</span>}
</div>
)
diff --git a/web/app/components/workflow/nodes/agent/components/tool-icon.tsx b/web/app/components/workflow/nodes/agent/components/tool-icon.tsx
index 34f121f8e10..08e6b1e4a88 100644
--- a/web/app/components/workflow/nodes/agent/components/tool-icon.tsx
+++ b/web/app/components/workflow/nodes/agent/components/tool-icon.tsx
@@ -92,11 +92,12 @@ export const ToolIcon = memo(({ providerName }: ToolIconProps) => {
}
const iconNode = (
- <div aria-label={tooltip} className={cn('relative')} ref={containerRef}>
+ <div className={cn('relative')} ref={containerRef}>
<div className="flex size-5 items-center justify-center overflow-hidden rounded-md border-[0.5px] border-components-panel-border-subtle bg-background-default-dodge">
{iconContent}
</div>
{indicator && <StatusDot status={indicator} className="absolute -top-px -right-px" />}
+ {tooltip && <span className="sr-only">{tooltip}</span>}
</div>
)
diff --git a/web/app/components/workflow/nodes/question-classifier/components/class-item.tsx b/web/app/components/workflow/nodes/question-classifier/components/class-item.tsx
index f69cc24012c..ca0ff00ebfd 100644
--- a/web/app/components/workflow/nodes/question-classifier/components/class-item.tsx
+++ b/web/app/components/workflow/nodes/question-classifier/components/class-item.tsx
@@ -122,7 +122,6 @@ const ClassItem: FC<Props> = ({
) : (
<button
type="button"
- aria-label={displayLabel}
className={cn(
'-ml-1 rounded px-1 py-0.5 text-left text-xs/4 font-semibold text-text-secondary transition-colors',
'cursor-text hover:bg-state-base-hover',
diff --git a/web/features/agent-v2/agent-detail/access/components/service-api-access-card.tsx b/web/features/agent-v2/agent-detail/access/components/service-api-access-card.tsx
index 93b5f4b9df5..a1496e41320 100644
--- a/web/features/agent-v2/agent-detail/access/components/service-api-access-card.tsx
+++ b/web/features/agent-v2/agent-detail/access/components/service-api-access-card.tsx
@@ -101,7 +101,6 @@ export function ServiceApiAccessCard({ agentId }: { agentId: string }) {
href={docLink('/api-reference/guides/agent')}
target="_blank"
rel="noreferrer"
- aria-label={t(($) => $['agentDetail.access.serviceApi.actions.apiReference'])}
className={buttonVariants({ variant: 'secondary', size: 'medium' })}
>
<span aria-hidden className="i-ri-book-open-line size-4" />
diff --git a/web/features/agent-v2/agent-detail/configure/components/orchestrate/advanced/env.tsx b/web/features/agent-v2/agent-detail/configure/components/orchestrate/advanced/env.tsx
index 0abf2087e80..dc2cc12bc80 100644
--- a/web/features/agent-v2/agent-detail/configure/components/orchestrate/advanced/env.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/orchestrate/advanced/env.tsx
@@ -562,9 +562,6 @@ export function AgentEnvEditor() {
render={
<button
type="button"
- aria-label={t(
- ($) => $['agentDetail.configure.advancedSettings.envEditor.importEnv'],
- )}
onClick={() => envImportInputRef.current?.click()}
className="flex h-6 shrink-0 items-center gap-1 rounded-md px-1.5 py-1 text-text-tertiary hover:bg-state-base-hover hover:text-text-secondary focus-visible:ring-2 focus-visible:ring-state-accent-solid focus-visible:outline-hidden"
>
diff --git a/web/features/agent-v2/agent-detail/configure/components/orchestrate/common/missing-reference-warning.tsx b/web/features/agent-v2/agent-detail/configure/components/orchestrate/common/missing-reference-warning.tsx
index 03febb2df6f..90814f70781 100644
--- a/web/features/agent-v2/agent-detail/configure/components/orchestrate/common/missing-reference-warning.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/orchestrate/common/missing-reference-warning.tsx
@@ -26,7 +26,7 @@ export function MissingReferenceWarning({
</button>
}
/>
- <TooltipContent aria-label={label}>{label}</TooltipContent>
+ <TooltipContent>{label}</TooltipContent>
</Tooltip>
)
}
diff --git a/web/features/agent-v2/agent-detail/configure/components/orchestrate/tools/provider-tool/item.tsx b/web/features/agent-v2/agent-detail/configure/components/orchestrate/tools/provider-tool/item.tsx
index f967f6b33b9..54bca92f511 100644
--- a/web/features/agent-v2/agent-detail/configure/components/orchestrate/tools/provider-tool/item.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/orchestrate/tools/provider-tool/item.tsx
@@ -328,12 +328,7 @@ export const AgentProviderToolItem = memo(
</CollapsibleTrigger>
{!readOnly && (
<DropdownMenu modal={false}>
- <DropdownMenuTrigger
- aria-label={t(($) => $['agentDetail.configure.tools.moreActions'], {
- name: tool.name,
- })}
- className="flex size-6 shrink-0 items-center justify-center rounded-md text-text-tertiary hover:bg-state-base-hover hover:text-text-secondary focus-visible:ring-2 focus-visible:ring-state-accent-solid focus-visible:outline-hidden data-popup-open:bg-state-base-hover"
- >
+ <DropdownMenuTrigger className="flex size-6 shrink-0 items-center justify-center rounded-md text-text-tertiary hover:bg-state-base-hover hover:text-text-secondary focus-visible:ring-2 focus-visible:ring-state-accent-solid focus-visible:outline-hidden data-popup-open:bg-state-base-hover">
<span className="sr-only">
{t(($) => $['agentDetail.configure.tools.moreActions'], { name: tool.name })}
</span>
diff --git a/web/features/agent-v2/agent-detail/configure/components/preview/__tests__/header.spec.tsx b/web/features/agent-v2/agent-detail/configure/components/preview/__tests__/header.spec.tsx
index 52b78fff071..a6f8cc915e7 100644
--- a/web/features/agent-v2/agent-detail/configure/components/preview/__tests__/header.spec.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/preview/__tests__/header.spec.tsx
@@ -122,7 +122,7 @@ describe('AgentPreviewHeader', () => {
renderHeader({ mode: 'build', onOpenWorkingDirectory, showWorkingDirectoryAction: true })
const fileSystemButton = screen.getByRole('button', {
- name: 'agentV2.agentDetail.configure.workingDirectory.open',
+ name: 'agentV2.agentDetail.configure.workingDirectory.fileSystem',
})
expect(fileSystemButton).toHaveTextContent(
'agentV2.agentDetail.configure.workingDirectory.fileSystem',
@@ -137,7 +137,9 @@ describe('AgentPreviewHeader', () => {
renderHeader({ mode: 'build' })
expect(
- screen.queryByRole('button', { name: 'agentV2.agentDetail.configure.workingDirectory.open' }),
+ screen.queryByRole('button', {
+ name: 'agentV2.agentDetail.configure.workingDirectory.fileSystem',
+ }),
).not.toBeInTheDocument()
})
@@ -171,7 +173,9 @@ describe('AgentPreviewHeader', () => {
})
await user.hover(
- screen.getByLabelText('agentV2.agentDetail.configure.rightPanel.previewDisabledTip'),
+ screen.getByLabelText(
+ 'agentV2.agentDetail.configure.rightPanel.preview. agentV2.agentDetail.configure.rightPanel.previewDisabledTip',
+ ),
)
expect(
diff --git a/web/features/agent-v2/agent-detail/configure/components/preview/header.tsx b/web/features/agent-v2/agent-detail/configure/components/preview/header.tsx
index 4ba43994f03..d0380318b35 100644
--- a/web/features/agent-v2/agent-detail/configure/components/preview/header.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/preview/header.tsx
@@ -66,10 +66,12 @@ function ModeInfoTip({ children, ariaLabel }: { children: ReactNode; ariaLabel:
function PreviewModeItem({
previewEnabled,
+ label,
disabledTip,
children,
}: {
previewEnabled: boolean
+ label: string
disabledTip: string
children: ReactNode
}) {
@@ -90,7 +92,7 @@ function PreviewModeItem({
<PopoverTrigger
openOnHover
nativeButton={false}
- aria-label={disabledTip}
+ aria-label={`${label}. ${disabledTip}`}
render={<span className="inline-flex" />}
>
{item}
@@ -165,7 +167,11 @@ export function AgentPreviewHeader({
<span aria-hidden className="i-custom-vender-agent-v2-configure-build size-4" />
{t(($) => $['agentDetail.configure.rightPanel.build'])}
</SegmentedControlItem>
- <PreviewModeItem previewEnabled={previewEnabled} disabledTip={previewDisabledTip}>
+ <PreviewModeItem
+ previewEnabled={previewEnabled}
+ label={previewLabel}
+ disabledTip={previewDisabledTip}
+ >
<span aria-hidden className="i-custom-vender-agent-v2-configure-preview size-4" />
{t(($) => $['agentDetail.configure.rightPanel.preview'])}
</PreviewModeItem>
@@ -222,7 +228,6 @@ export function AgentPreviewHeader({
type="button"
onClick={onOpenWorkingDirectory}
className="flex h-8 items-center justify-center gap-0.5 rounded-lg px-3 py-2 text-text-tertiary hover:bg-state-base-hover hover:text-text-secondary focus-visible:ring-2 focus-visible:ring-state-accent-solid focus-visible:outline-hidden"
- aria-label={t(($) => $['agentDetail.configure.workingDirectory.open'])}
>
<span aria-hidden className="i-ri-folder-3-line size-4" />
<span className="px-0.5 system-sm-medium">
@@ -242,7 +247,6 @@ export function AgentPreviewHeader({
'flex h-8 items-center justify-center gap-1 rounded-lg px-2 py-2 text-text-tertiary hover:bg-state-base-hover hover:text-text-secondary focus-visible:ring-2 focus-visible:ring-state-accent-solid focus-visible:outline-hidden',
isChatFeaturesOpen && 'bg-state-base-hover text-text-secondary',
)}
- aria-label={t(($) => $['agentDetail.configure.preview.chatFeatures'])}
>
<span aria-hidden className="i-ri-chat-settings-line size-4" />
<span className="px-0.5 system-sm-medium">
diff --git a/web/features/agent-v2/agent-detail/configure/components/preview/working-directory-panel.tsx b/web/features/agent-v2/agent-detail/configure/components/preview/working-directory-panel.tsx
index 3abf047d8fe..d4115e756e8 100644
--- a/web/features/agent-v2/agent-detail/configure/components/preview/working-directory-panel.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/preview/working-directory-panel.tsx
@@ -673,10 +673,9 @@ export function AgentWorkingDirectoryPanel({
onSelectFile: (selectedFile) => setSelectedFileId(selectedFile.id),
renderFolderSuffix: ({ file }) =>
loadingFolderPaths.has(file.id) ? (
- <span
- aria-label={tCommon(($) => $.loading)}
- className="ms-auto i-ri-loader-4-line size-4 shrink-0 animate-spin text-text-tertiary"
- />
+ <span className="ms-auto i-ri-loader-4-line size-4 shrink-0 animate-spin text-text-tertiary">
+ <span className="sr-only">{tCommon(($) => $.loading)}</span>
+ </span>
) : null,
selectedFileId: selectedWorkingDirectoryFile?.id,
sections: [],
diff --git a/web/features/new-rag/__tests__/new-knowledge-list.spec.tsx b/web/features/new-rag/__tests__/new-knowledge-list.spec.tsx
index 0ab12ddc07c..3c46e3a6c43 100644
--- a/web/features/new-rag/__tests__/new-knowledge-list.spec.tsx
+++ b/web/features/new-rag/__tests__/new-knowledge-list.spec.tsx
@@ -195,7 +195,7 @@ describe('NewKnowledgeList', () => {
).toHaveAttribute('href', '/datasets/new/space-2/sources')
expect(within(list).getByText('Answers for customer support')).toBeInTheDocument()
expect(within(list).getByText('dataset.newKnowledge.noDescription')).toBeInTheDocument()
- expect(within(supportCard).getByLabelText('camera')).toBeInTheDocument()
+ expect(within(supportCard).getByTitle('camera')).toBeInTheDocument()
expect(within(list).getAllByText('dataset.newKnowledge.cardType')).toHaveLength(2)
expect(within(list).getAllByText('dataset.newKnowledge.tags')).toHaveLength(2)
expect(within(list).getAllByText('dataset.newKnowledge.documentsUnavailable')).toHaveLength(2)
diff --git a/web/features/new-rag/components/knowledge-space-card.tsx b/web/features/new-rag/components/knowledge-space-card.tsx
index 587c372c385..d3f32d992ca 100644
--- a/web/features/new-rag/components/knowledge-space-card.tsx
+++ b/web/features/new-rag/components/knowledge-space-card.tsx
@@ -27,7 +27,6 @@ export function KnowledgeSpaceCard({ knowledgeSpace }: { knowledgeSpace: Knowled
>
<div className="flex w-full items-center gap-3 px-4 pt-4 pb-1.5">
<div
- aria-label={iconName ?? t(($) => $['newKnowledge.cardType'])}
title={iconName}
className="flex size-10 shrink-0 items-center justify-center rounded-[10px] border-[0.5px] border-divider-regular bg-components-icon-bg-orange-dark-soft"
>
@@ -51,10 +50,7 @@ export function KnowledgeSpaceCard({ knowledgeSpace }: { knowledgeSpace: Knowled
<p className="line-clamp-2 min-h-8 w-full px-4 py-0.5 body-xs-regular text-text-tertiary">
{knowledgeSpace.description || t(($) => $['newKnowledge.noDescription'])}
</p>
- <div
- aria-label={`${t(($) => $['newKnowledge.tags'])}. ${unavailable}`}
- className="mt-1 flex min-w-0 items-center gap-1 px-4"
- >
+ <div className="mt-1 flex min-w-0 items-center gap-1 px-4">
<span className="rounded-md bg-background-section px-1.5 py-0.5 system-2xs-medium-uppercase text-text-disabled">
{t(($) => $['newKnowledge.tags'])}
</span>
diff --git a/web/features/new-rag/document-chunk-tree.tsx b/web/features/new-rag/document-chunk-tree.tsx
index 90f49c70d51..bc32b68221b 100644
--- a/web/features/new-rag/document-chunk-tree.tsx
+++ b/web/features/new-rag/document-chunk-tree.tsx
@@ -4,7 +4,7 @@ import type { DocumentChunkTree } from './document-detail-model'
import { Button } from '@langgenius/dify-ui/button'
import { cn } from '@langgenius/dify-ui/cn'
import { defaultRangeExtractor, useVirtualizer } from '@tanstack/react-virtual'
-import { useEffect, useMemo, useRef, useState } from 'react'
+import { useEffect, useId, useMemo, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
import Loading from '@/app/components/base/loading'
import { chunkTreeLabel, visibleDocumentChunkNodes } from './document-detail-model'
@@ -39,6 +39,7 @@ export function DocumentChunkTreePanel({
}) {
const { t } = useTranslation('dataset')
const { t: tCommon } = useTranslation('common')
+ const treeHeadingId = useId()
const [collapsedChunkIds, setCollapsedChunkIds] = useState<Set<string>>(() => new Set())
const [focusedChunkId, setFocusedChunkId] = useState<string>()
const [treeHasFocus, setTreeHasFocus] = useState(false)
@@ -159,7 +160,6 @@ export function DocumentChunkTreePanel({
key={chunk.id}
id={`document-chunk-treeitem-${chunk.id}`}
aria-expanded={hasChildren ? expanded : undefined}
- aria-label={label}
aria-level={depth + 1}
aria-posinset={positionInSet}
aria-selected={selectedChunkId === chunk.id}
@@ -195,7 +195,7 @@ export function DocumentChunkTreePanel({
return (
<aside className="min-h-52 overflow-hidden">
- <h2 className="px-2 pb-2 system-xs-regular text-text-tertiary">
+ <h2 id={treeHeadingId} className="px-2 pb-2 system-xs-regular text-text-tertiary">
{t(($) => $['newKnowledge.documentContents'])}
</h2>
{error && !isFetchNextPageError && chunkCount > 0 && (
@@ -231,7 +231,7 @@ export function DocumentChunkTreePanel({
aria-activedescendant={
currentFocusedChunkId ? `document-chunk-treeitem-${currentFocusedChunkId}` : undefined
}
- aria-label={t(($) => $['newKnowledge.documentContents'])}
+ aria-labelledby={treeHeadingId}
className="max-h-[70vh] overflow-auto py-1 pr-4 pl-1 outline-hidden"
role="tree"
tabIndex={0}
diff --git a/web/features/skills/__tests__/detail-page.spec.tsx b/web/features/skills/__tests__/detail-page.spec.tsx
index 7e8c8f33dbb..493df2fc66d 100644
--- a/web/features/skills/__tests__/detail-page.spec.tsx
+++ b/web/features/skills/__tests__/detail-page.spec.tsx
@@ -5211,7 +5211,7 @@ describe('SkillDetailPage', () => {
fireEvent.dragOver(contextRegion, { dataTransfer })
- expect(screen.getByLabelText('Upload to root folder')).toBeInTheDocument()
+ expect(screen.getByText(/^Upload to/)).toHaveTextContent(/^Upload to root folder$/)
fireEvent.drop(contextRegion, { dataTransfer })
await confirmUploadReview()
@@ -5341,7 +5341,7 @@ describe('SkillDetailPage', () => {
fireEvent.dragOver(folder.closest('li')!, { dataTransfer })
expect(folder).toHaveClass('ring-state-accent-solid')
- expect(screen.getByLabelText('Upload to references')).toBeInTheDocument()
+ expect(screen.getByText(/^Upload to/)).toHaveTextContent(/^Upload to references$/)
fireEvent.drop(folder.closest('li')!, { dataTransfer })
await confirmUploadReview()
@@ -5585,7 +5585,7 @@ describe('SkillDetailPage', () => {
expect(exampleFile).toHaveClass('opacity-30')
fireEvent.dragOver(targetFolder.closest('li')!, { dataTransfer })
- expect(screen.getByLabelText('Move to references')).toBeInTheDocument()
+ expect(screen.getByText(/^Move to/)).toHaveTextContent(/^Move to references$/)
fireEvent.drop(targetFolder.closest('li')!, { dataTransfer })
await waitFor(() => {
diff --git a/web/features/skills/detail/file-tree-dnd.tsx b/web/features/skills/detail/file-tree-dnd.tsx
index 3ceb85bb41f..5f527f1e08d 100644
--- a/web/features/skills/detail/file-tree-dnd.tsx
+++ b/web/features/skills/detail/file-tree-dnd.tsx
@@ -16,14 +16,10 @@ export function SkillDropDestinationHint({ target }: { target: SkillDropTarget |
const destination = target.path || 'root folder'
const action = target.operation === 'upload' ? 'Upload' : 'Move'
- const label = `${action} to ${destination}`
return (
<div className="pointer-events-none absolute inset-x-1 bottom-2 z-10 flex justify-center">
<div className="flex h-7 max-w-full items-center rounded-lg border-[0.5px] border-components-panel-border bg-components-tooltip-bg p-1.5 shadow-lg shadow-shadow-shadow-5 backdrop-blur-[5px]">
- <span
- aria-label={label}
- className="max-w-full truncate px-0.5 system-xs-regular text-text-secondary"
- >
+ <span className="max-w-full truncate px-0.5 system-xs-regular text-text-secondary">
{action} to <strong className="font-medium">{destination}</strong>
</span>
</div>
diff --git a/web/features/skills/detail/skill-pdf-preview.tsx b/web/features/skills/detail/skill-pdf-preview.tsx
index 88296f8b41a..d407c23f414 100644
--- a/web/features/skills/detail/skill-pdf-preview.tsx
+++ b/web/features/skills/detail/skill-pdf-preview.tsx
@@ -9,7 +9,8 @@ import Loading from '@/app/components/base/loading'
export function SkillPdfPreview({ fileName, url }: { fileName: string; url: string }) {
return (
- <div aria-label={fileName} className="relative h-full overflow-hidden bg-background-default">
+ <div className="relative h-full overflow-hidden bg-background-default">
+ <span className="sr-only">{fileName}</span>
<PdfLoader
workerSrc="/pdf.worker.min.mjs"
url={url}