Skip to content

Commit ef0f603

Browse files
committed
Fixes #4812 prevents text selection with shift click in the composer
1 parent e1f03ac commit ef0f603

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/webviews/apps/plus/composer/components/commit-item.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,17 @@ export class CommitItem extends LitElement {
101101
this.dataset.commitId = this.commitId;
102102
}
103103

104-
private handleClick(e: MouseEvent | KeyboardEvent) {
105-
// Don't select commit if clicking on drag handle
106-
if ((e.target as HTMLElement).closest('.drag-handle') || (e instanceof KeyboardEvent && e.key !== 'Enter')) {
107-
return;
108-
}
109-
104+
private handleMouseDown(e: MouseEvent) {
110105
// Prevent text selection when shift-clicking
111106
if (e.shiftKey) {
112107
e.preventDefault();
113108
}
109+
}
110+
111+
private handleClick(e: MouseEvent | KeyboardEvent) {
112+
if ((e.target as HTMLElement).closest('.drag-handle') || (e instanceof KeyboardEvent && e.key !== 'Enter')) {
113+
return;
114+
}
114115

115116
this.dispatchEvent(
116117
new CustomEvent('commit-selected', {
@@ -136,6 +137,7 @@ export class CommitItem extends LitElement {
136137
tabindex="0"
137138
@click=${this.handleClick}
138139
@keydown=${this.handleClick}
140+
@mousedown=${this.handleMouseDown}
139141
>
140142
${when(
141143
!this.isPreviewMode,

0 commit comments

Comments
 (0)