fix checkbox and radio button click issue (#14965)

This commit is contained in:
Alan Ren
2021-04-05 10:11:39 -07:00
committed by GitHub
parent 4dc3999f46
commit 6b855a9776
2 changed files with 10 additions and 3 deletions

View File

@@ -6,6 +6,7 @@
import { Event, Emitter } from 'vs/base/common/event';
import { Widget } from 'vs/base/browser/ui/widget';
import { withNullAsUndefined } from 'vs/base/common/types';
import { generateUuid } from 'vs/base/common/uuid';
export interface IRadioButtonOptions {
label: string;
@@ -25,13 +26,16 @@ export class RadioButton extends Widget {
constructor(container: HTMLElement, opts: IRadioButtonOptions) {
super();
const id = generateUuid();
this.inputElement = document.createElement('input');
this.inputElement.type = 'radio';
this.inputElement.style.verticalAlign = 'middle';
this.inputElement.style.margin = '3px';
this.inputElement.id = id;
this._label = document.createElement('span');
this._label = document.createElement('label');
this._label.style.verticalAlign = 'middle';
this._label.setAttribute('for', id);
this.label = opts.label;
this.enabled = opts.enabled || true;