mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-14 01:25:37 -05:00
fix issue that user is not able to interact with checkbox in declarative table using keyboard (#14863)
* handle space key press * correct fix
This commit is contained in:
@@ -7,7 +7,6 @@ import 'vs/css!./media/checkbox';
|
||||
|
||||
import { Color } from 'vs/base/common/color';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { KeyCode } from 'vs/base/common/keyCodes';
|
||||
import { Widget } from 'vs/base/browser/ui/widget';
|
||||
|
||||
export interface ICheckboxOptions {
|
||||
@@ -45,15 +44,6 @@ export class Checkbox extends Widget {
|
||||
this._onChange.fire(this.checked);
|
||||
});
|
||||
|
||||
this.onkeydown(this._el, e => {
|
||||
if (e.equals(KeyCode.Enter)) {
|
||||
this.checked = !this.checked;
|
||||
// Manually fire the event since we stop the event propagation which means
|
||||
// the onchange event won't fire.
|
||||
this._onChange.fire(this.checked);
|
||||
e.stopPropagation();
|
||||
}
|
||||
});
|
||||
|
||||
this._label = document.createElement('span');
|
||||
this._label.style.verticalAlign = 'middle';
|
||||
|
||||
@@ -331,6 +331,10 @@ export default class DeclarativeTableComponent extends ContainerBase<any, azdata
|
||||
}
|
||||
|
||||
public onKey(e: KeyboardEvent, row: number) {
|
||||
// Ignore the bubble up events
|
||||
if (e.target !== e.currentTarget) {
|
||||
return;
|
||||
}
|
||||
const event = new StandardKeyboardEvent(e);
|
||||
if (event.equals(KeyCode.Enter) || event.equals(KeyCode.Space)) {
|
||||
this.onRowSelected(row);
|
||||
|
||||
Reference in New Issue
Block a user