Comment thread reply area does not collapse on blur: expand class toggled on different elements
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
Type: Bug
In a comment thread with existing comments, the reply area expands when the reply button gets focus, but it never collapses again when the editor loses focus with no text in it. The thread keeps the full-height editor and its action buttons until the reviewer submits a comment or collapses the whole thread.
The blur handler and the expand code use different elements. `expandReplyArea` adds the `expand` class to `this._container` (`.comment-form-container`), and `review.css` keys the editor and `.form-actions` visibility on `.comment-form-container.expand`. The blur handler in `createReplyButton` checks and removes `expand` on `commentForm`, which is the inner `.comment-form` element and never carries the class, so the check is always false:
https://github.com/microsoft/vscode/blob/main/src/vs/workbench/contrib/comments/browser/commentReply.ts#L338-L341
https://github.com/microsoft/vscode/blob/main/src/vs/workbench/contrib/comments/browser/commentReply.ts#L376-L380
The same mismatch is in the text model listener that clears the form when the value becomes empty (`commentForm.classList.remove('expand')` at line 275).
Steps:
1. Have any extension that uses `vscode.comments` create a comment thread with at least one comment (the `comment-sample` extension from vscode-extension-samples works).
2. Expand the thread and click the "Reply..." row. The editor and the action buttons appear.
3. Click into the document, outside the widget, without typing.
Expected: the reply area returns to the single "Reply..." row, as the blur handler intends.
Actual: the editor stays at full height with the action buttons below it. Only submitting a comment or collapsing the thread shrinks it.
Related: #335943 (the same widget, clipped by the minimap).
VS Code version: 1.138.0-insider (60ac69b364809ee6976d6dc3ed74cc7628f637da, x64)
OS: Windows 11 Home 10.0.26200
Contributor guide
Assessment
This issue has not been assessed yet.