Skip to content

Commit

Permalink
Prevent checkbox toggle (fixes #91740)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrmarti committed Mar 27, 2020
1 parent c456674 commit 81521ba
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/vs/base/parts/quickinput/browser/quickInputList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ class ListElementRenderer implements IListRenderer<ListElement, IListElementTemp

// Checkbox
const label = dom.append(data.entry, $('label.quick-input-list-label'));
data.toDisposeTemplate.push(dom.addStandardDisposableListener(label, dom.EventType.CLICK, e => {
if (!data.checkbox.offsetParent) { // If checkbox not visible:
e.preventDefault(); // Prevent toggle of checkbox when it is immediately shown afterwards. #91740
}
}));
data.checkbox = <HTMLInputElement>dom.append(label, $('input.quick-input-list-checkbox'));
data.checkbox.type = 'checkbox';
data.toDisposeTemplate.push(dom.addStandardDisposableListener(data.checkbox, dom.EventType.CHANGE, e => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ import { fromNow } from 'vs/base/common/date';
import { IProductService } from 'vs/platform/product/common/productService';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { IOpenerService } from 'vs/platform/opener/common/opener';
import { timeout } from 'vs/base/common/async';
import { distinct } from 'vs/base/common/arrays';

const enum AuthStatus {
Expand Down Expand Up @@ -1074,8 +1073,7 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
quickPick.items = items;
disposables.add(quickPick.onDidAccept(() => {
if (quickPick.selectedItems[0] && quickPick.selectedItems[0].id) {
// Introduce timeout as workaround - #91661 #91740
timeout(0).then(() => commandService.executeCommand(quickPick.selectedItems[0].id!));
commandService.executeCommand(quickPick.selectedItems[0].id);
}
quickPick.hide();
}));
Expand Down

0 comments on commit 81521ba

Please sign in to comment.