From 2debd8b9a41df6283669973848ed67d85a45926f Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Mon, 20 Nov 2017 14:28:57 -0800 Subject: [PATCH] Fix settings search icon blinking visibility at startup. Checkbox.ts is wiping out classes added externally. --- src/vs/base/browser/ui/checkbox/checkbox.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/vs/base/browser/ui/checkbox/checkbox.ts b/src/vs/base/browser/ui/checkbox/checkbox.ts index 7f597cca2e9..ed317973874 100644 --- a/src/vs/base/browser/ui/checkbox/checkbox.ts +++ b/src/vs/base/browser/ui/checkbox/checkbox.ts @@ -45,7 +45,7 @@ export class Checkbox extends Widget { this.domNode = document.createElement('div'); this.domNode.title = this._opts.title; - this.domNode.className = this._className(); + this.domNode.className = 'custom-checkbox ' + this._opts.actionClassName + ' ' + (this._checked ? 'checked' : 'unchecked'); this.domNode.tabIndex = 0; this.domNode.setAttribute('role', 'checkbox'); this.domNode.setAttribute('aria-checked', String(this._checked)); @@ -88,12 +88,13 @@ export class Checkbox extends Widget { public set checked(newIsChecked: boolean) { this._checked = newIsChecked; this.domNode.setAttribute('aria-checked', String(this._checked)); - this.domNode.className = this._className(); - this.applyStyles(); - } + if (this._checked) { + this.domNode.classList.add('checked'); + } else { + this.domNode.classList.remove('checked'); + } - private _className(): string { - return 'custom-checkbox ' + this._opts.actionClassName + ' ' + (this._checked ? 'checked' : 'unchecked'); + this.applyStyles(); } public width(): number {