Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions webview-ui/src/components/chat/ChatRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1172,9 +1172,10 @@ export const ChatRowContent = ({
)
case "user_feedback":
return (
<div className="bg-vscode-editor-background border rounded-xs p-1 overflow-hidden whitespace-pre-wrap">
<div
className={`bg-vscode-editor-background border rounded-xs overflow-hidden whitespace-pre-wrap ${isEditing ? "p-0" : "p-1"}`}>
{isEditing ? (
<div className="flex flex-col gap-2 p-2">
<div className="flex flex-col gap-2">
<ChatTextArea
inputValue={editedContent}
setInputValue={setEditedContent}
Expand All @@ -1195,7 +1196,15 @@ export const ChatRowContent = ({
</div>
) : (
<div className="flex justify-between">
<div className="flex-grow px-2 py-1 wrap-anywhere">
<div
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The clickable message text container now calls handleEditClick correctly. Consider adding accessibility attributes (e.g., role='button' and an appropriate aria-label) to improve keyboard navigation and screen reader support.

className="flex-grow px-2 py-1 wrap-anywhere cursor-pointer hover:bg-vscode-list-hoverBackground rounded transition-colors"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding an aria-label attribute here for better accessibility. Screen reader users would benefit from knowing this area is clickable for editing:

Suggested change
className="flex-grow px-2 py-1 wrap-anywhere cursor-pointer hover:bg-vscode-list-hoverBackground rounded transition-colors"
<div
className="flex-grow px-2 py-1 wrap-anywhere cursor-pointer hover:bg-vscode-list-hoverBackground rounded transition-colors"
aria-label={t("chat:queuedMessages.clickToEdit")}
onClick={(e) => {

onClick={(e) => {
e.stopPropagation()
if (!isStreaming) {
handleEditClick()
}
}}
title={t("chat:queuedMessages.clickToEdit")}>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This reuses the queued messages translation key. Would it be clearer to have a dedicated key like chat:pastMessages.clickToEdit for future maintenance? This way, if we need different text for past vs queued messages, we won't break anything.

<Mention text={message.text} withShadow />
</div>
<div className="flex">
Expand Down
48 changes: 24 additions & 24 deletions webview-ui/src/components/chat/ChatTextArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -903,20 +903,8 @@ export const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
return (
<div
className={cn(
"relative",
"flex",
"flex-col",
"gap-1",
"bg-editor-background",
"px-1.5",
"pb-1",
"outline-none",
"border",
"border-none",
"w-[calc(100%-16px)]",
"ml-auto",
"mr-auto",
"box-border",
"relative flex flex-col gap-1 bg-editor-background outline-none border border-none box-border",
isEditMode ? "p-2 w-full" : "px-1.5 pb-1 w-[calc(100%-16px)] ml-auto mr-auto",
)}>
<div className="relative">
<div
Expand Down Expand Up @@ -1005,11 +993,12 @@ export const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
: isDraggingOver
? "border-2 border-dashed border-vscode-focusBorder"
: "border border-transparent",
"px-[8px]",
"py-1.5",
"pr-9",
"pl-2",
"py-2",
isEditMode ? "pr-[72px]" : "pr-9",
"z-10",
"forced-color-adjust-none",
"rounded",
)}
style={{
color: "transparent",
Expand All @@ -1030,7 +1019,15 @@ export const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
updateHighlights()
}}
onFocus={() => setIsFocused(true)}
onKeyDown={handleKeyDown}
onKeyDown={(e) => {
// Handle ESC to cancel in edit mode
if (isEditMode && e.key === "Escape" && !e.nativeEvent?.isComposing) {
e.preventDefault()
onCancel?.()
return
}
handleKeyDown(e)
}}
onKeyUp={handleKeyUp}
onBlur={handleBlur}
onPaste={handlePaste}
Expand All @@ -1054,7 +1051,7 @@ export const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
"text-vscode-editor-font-size",
"leading-vscode-editor-line-height",
"cursor-text",
"py-1.5 px-2",
"py-2 pl-2",
isFocused
? "border border-vscode-focusBorder outline outline-vscode-focusBorder"
: isDraggingOver
Expand All @@ -1071,7 +1068,7 @@ export const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
"resize-none",
"overflow-x-hidden",
"overflow-y-auto",
"pr-9",
isEditMode ? "pr-[72px]" : "pr-9",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency, could we use the same unit here? Currently mixing px and rem units:

Suggested change
isEditMode ? "pr-[72px]" : "pr-9",
isEditMode ? "pr-[4.5rem]" : "pr-9",

This would make the spacing more maintainable and consistent with the design system.

"flex-none flex-grow",
"z-[2]",
"scrollbar-none",
Expand All @@ -1080,7 +1077,7 @@ export const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
onScroll={() => updateHighlights()}
/>

<div className="absolute top-1 right-1 z-30">
<div className="absolute top-2 right-2 z-30">
<StandardTooltip content={t("chat:enhancePrompt")}>
<button
aria-label={t("chat:enhancePrompt")}
Expand All @@ -1102,7 +1099,7 @@ export const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
</StandardTooltip>
</div>

<div className="absolute bottom-1 right-1 z-30">
<div className="absolute bottom-2 right-2 z-30">
{isEditMode && (
<StandardTooltip content={t("chat:cancel.title")}>
<button
Expand Down Expand Up @@ -1147,9 +1144,12 @@ export const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(

{!inputValue && (
<div
className="absolute left-2 z-30 pr-9 flex items-center h-8 font-vscode-font-family text-vscode-editor-font-size leading-vscode-editor-line-height"
className={cn(
"absolute left-2 z-30 flex items-center h-8 font-vscode-font-family text-vscode-editor-font-size leading-vscode-editor-line-height",
isEditMode ? "pr-[72px]" : "pr-9",
)}
style={{
bottom: "0.25rem",
bottom: "0.75rem",
color: "color-mix(in oklab, var(--vscode-input-foreground) 50%, transparent)",
userSelect: "none",
pointerEvents: "none",
Expand Down
Loading