mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-24 09:35:37 -05:00
fix checkbox and radio button click issue (#14965)
This commit is contained in:
@@ -8,6 +8,7 @@ import 'vs/css!./media/checkbox';
|
||||
import { Color } from 'vs/base/common/color';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { Widget } from 'vs/base/browser/ui/widget';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
|
||||
export interface ICheckboxOptions {
|
||||
label: string;
|
||||
@@ -31,10 +32,11 @@ export class Checkbox extends Widget {
|
||||
|
||||
constructor(container: HTMLElement, opts: ICheckboxOptions) {
|
||||
super();
|
||||
|
||||
const id = generateUuid();
|
||||
this._el = document.createElement('input');
|
||||
this._el.type = 'checkbox';
|
||||
this._el.style.verticalAlign = 'middle';
|
||||
this._el.id = id;
|
||||
|
||||
if (opts.ariaLabel) {
|
||||
this.ariaLabel = opts.ariaLabel;
|
||||
@@ -45,8 +47,9 @@ export class Checkbox extends Widget {
|
||||
});
|
||||
|
||||
|
||||
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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user