Skip to content

Commit 0129eda

Browse files
author
Rachel Macfarlane
committed
Expand comment reply area on focus
1 parent ffba25f commit 0129eda

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

src/vs/workbench/parts/comments/electron-browser/commentThreadWidget.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -473,17 +473,20 @@ export class ReviewZoneWidget extends ZoneWidget {
473473
this._headingLabel.setAttribute('aria-label', label);
474474
}
475475

476+
private expandReplyArea() {
477+
if (!dom.hasClass(this._commentForm, 'expand')) {
478+
dom.addClass(this._commentForm, 'expand');
479+
this._commentEditor.focus();
480+
}
481+
}
482+
476483
private createReplyButton() {
477484
this._reviewThreadReplyButton = <HTMLButtonElement>dom.append(this._commentForm, dom.$('button.review-thread-reply-button'));
478485
this._reviewThreadReplyButton.title = nls.localize('reply', "Reply...");
479486
this._reviewThreadReplyButton.textContent = nls.localize('reply', "Reply...");
480487
// bind click/escape actions for reviewThreadReplyButton and textArea
481-
this._reviewThreadReplyButton.onclick = () => {
482-
if (!dom.hasClass(this._commentForm, 'expand')) {
483-
dom.addClass(this._commentForm, 'expand');
484-
this._commentEditor.focus();
485-
}
486-
};
488+
this._localToDispose.push(dom.addDisposableListener(this._reviewThreadReplyButton, 'click', _ => this.expandReplyArea()));
489+
this._localToDispose.push(dom.addDisposableListener(this._reviewThreadReplyButton, 'focus', _ => this.expandReplyArea()));
487490

488491
this._commentEditor.onDidBlurEditorWidget(() => {
489492
if (this._commentEditor.getModel().getValueLength() === 0 && dom.hasClass(this._commentForm, 'expand')) {

0 commit comments

Comments
 (0)