From 0a0680065a0d5589b9b6ceacaf8c72e8968b988f Mon Sep 17 00:00:00 2001 From: Junyi Hou Date: Thu, 19 Feb 2026 01:44:53 +0800 Subject: [PATCH] refactor: enhance accessibility and code consistency across components - Improved accessibility by standardizing `onKeyDown` event handlers to use consistent formatting for key checks across multiple components. - Refactored layout of JSX elements for better readability in `chat.pb.go`, `embed-sidebar`, and various components in the message entry container. - General code cleanup to enhance maintainability and readability. --- pkg/gen/api/chat/v2/chat.pb.go | 7 ++++--- .../message-entry-container/assistant.tsx | 12 +++++++++++- .../message-entry-container/tools/general.tsx | 12 +++++++++++- .../paper-score-comment/filter-controls.tsx | 6 +++++- .../tools/xtramcp/generate-citations.tsx | 12 ++++++++++-- .../tools/xtramcp/online-search-papers.tsx | 12 ++++++++++-- .../tools/xtramcp/review-paper.tsx | 12 ++++++++++-- .../tools/xtramcp/search-relevant-papers.tsx | 12 ++++++++++-- .../tools/xtramcp/verify-citations.tsx | 12 ++++++++++-- .../tools/xtramcp/xtramcp-generic-card.tsx | 18 +++++++++++++++--- .../src/components/onboarding-guide.tsx | 12 ++++++++++-- webapp/_webapp/src/components/tabs.tsx | 8 +++++++- webapp/_webapp/src/libs/inline-suggestion.ts | 19 +++++++++++-------- webapp/_webapp/src/views/chat/body/index.tsx | 2 +- .../views/chat/footer/toolbar/selection.tsx | 10 ++++++++-- .../src/views/chat/header/chat-button.tsx | 2 +- webapp/_webapp/src/views/devtools/index.tsx | 4 +++- webapp/_webapp/src/views/embed-sidebar.tsx | 8 +++++++- webapp/_webapp/src/views/login/index.tsx | 6 +++++- .../src/views/login/login-with-overleaf.tsx | 6 +++++- webapp/_webapp/src/views/office/app.tsx | 2 ++ .../src/views/settings/sections/footer.tsx | 2 +- 22 files changed, 157 insertions(+), 39 deletions(-) diff --git a/pkg/gen/api/chat/v2/chat.pb.go b/pkg/gen/api/chat/v2/chat.pb.go index 485bfd0f..0d312c55 100644 --- a/pkg/gen/api/chat/v2/chat.pb.go +++ b/pkg/gen/api/chat/v2/chat.pb.go @@ -7,12 +7,13 @@ package chatv2 import ( - _ "google.golang.org/genproto/googleapis/api/annotations" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" sync "sync" unsafe "unsafe" + + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" ) const ( diff --git a/webapp/_webapp/src/components/message-entry-container/assistant.tsx b/webapp/_webapp/src/components/message-entry-container/assistant.tsx index ca692d44..92f30492 100644 --- a/webapp/_webapp/src/components/message-entry-container/assistant.tsx +++ b/webapp/_webapp/src/components/message-entry-container/assistant.tsx @@ -147,7 +147,17 @@ export const AssistantMessageContainer = ({ {((parsedMessage.regularContent?.length || 0) > 0 || parsedMessage.paperDebuggerContent.length > 0) && (
- { if (e.key === 'Enter' || e.key === ' ') { handleCopy(); } }} tabIndex={0} role="button" aria-label="Copy message"> + { + if (e.key === "Enter" || e.key === " ") { + handleCopy(); + } + }} + tabIndex={0} + role="button" + aria-label="Copy message" + > diff --git a/webapp/_webapp/src/components/message-entry-container/tools/general.tsx b/webapp/_webapp/src/components/message-entry-container/tools/general.tsx index c381ff03..db3aa39b 100644 --- a/webapp/_webapp/src/components/message-entry-container/tools/general.tsx +++ b/webapp/_webapp/src/components/message-entry-container/tools/general.tsx @@ -95,7 +95,17 @@ export const GeneralToolCard = ({ // When there is a message, show the compact card with collapsible content return (
-
{ if (e.key === 'Enter' || e.key === ' ') { toggleCollapse(); } }}> +
{ + if (e.key === "Enter" || e.key === " ") { + toggleCollapse(); + } + }} + >