From 612f9ee669c99d4f0879aecc9931e8dbb7c1d262 Mon Sep 17 00:00:00 2001
From: yyh <92089059+lyzno1@users.noreply.github.com>
Date: Mon, 10 Aug 2026 10:32:52 +0800
Subject: [PATCH] fix(web): use button for tool detail toggle (#40349)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
---
oxlint-suppressions.json | 8 -----
.../answer/__tests__/tool-detail.spec.tsx | 36 +++++++++++++++----
.../base/chat/chat/answer/tool-detail.tsx | 18 +++++-----
3 files changed, 39 insertions(+), 23 deletions(-)
diff --git a/oxlint-suppressions.json b/oxlint-suppressions.json
index 91d92173f8b..21fe1a65efb 100644
--- a/oxlint-suppressions.json
+++ b/oxlint-suppressions.json
@@ -839,14 +839,6 @@
"count": 1
}
},
- "web/app/components/base/chat/chat/answer/tool-detail.tsx": {
- "jsx_a11y/click-events-have-key-events": {
- "count": 1
- },
- "jsx_a11y/no-static-element-interactions": {
- "count": 1
- }
- },
"web/app/components/base/chat/chat/answer/workflow-process.tsx": {
"eslint-react/set-state-in-effect": {
"count": 1
diff --git a/web/app/components/base/chat/chat/answer/__tests__/tool-detail.spec.tsx b/web/app/components/base/chat/chat/answer/__tests__/tool-detail.spec.tsx
index 9d362ed5bdc..4a4b37c26a6 100644
--- a/web/app/components/base/chat/chat/answer/__tests__/tool-detail.spec.tsx
+++ b/web/app/components/base/chat/chat/answer/__tests__/tool-detail.spec.tsx
@@ -23,6 +23,9 @@ describe('ToolDetail', () => {
expect(screen.getByText('Test Tool Label')).toBeInTheDocument()
expect(screen.getByText('tools.thought.used')).toBeInTheDocument()
+ expect(
+ screen.getByRole('button', { name: 'tools.thought.used Test Tool Label' }),
+ ).toHaveAttribute('aria-expanded', 'false')
})
it('should render the knowledge label and "using" state when not finished and name is a dataset', () => {
@@ -30,28 +33,47 @@ describe('ToolDetail', () => {
expect(screen.getByText('dataset.knowledge')).toBeInTheDocument()
expect(screen.getByText('tools.thought.using')).toBeInTheDocument()
+ expect(
+ screen.getByRole('button', { name: 'tools.thought.using dataset.knowledge' }),
+ ).toHaveAttribute('aria-expanded', 'false')
})
it('should toggle expansion and show request/response details on click', async () => {
const user = userEvent.setup()
render(