enable keyboard for explain button and Line1 link in message pane (#1132)

This commit is contained in:
Abbie Petchtes
2018-04-11 16:50:41 -07:00
committed by GitHub
parent cd0210c88a
commit 091d4cb924
3 changed files with 22 additions and 4 deletions

View File

@@ -26,10 +26,12 @@ import { IBootstrapService, BOOTSTRAP_SERVICE_ID } from 'sql/services/bootstrap/
import { QueryComponentParams } from 'sql/services/bootstrap/bootstrapParams';
import { error } from 'sql/base/common/log';
import { TabChild } from 'sql/base/browser/ui/panel/tab.component';
import { clone } from 'sql/base/common/objects';
import * as strings from 'vs/base/common/strings';
import { clone } from 'sql/base/common/objects';
import * as DOM from 'vs/base/browser/dom';
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { KeyCode } from 'vs/base/common/keyCodes';
export const QUERY_SELECTOR: string = 'query-component';
@@ -150,7 +152,7 @@ export class QueryComponent extends GridParentComponent implements OnInit, OnDes
@ViewChildren('slickgrid') slickgrids: QueryList<SlickGrid>;
// tslint:disable-next-line:no-unused-variable
@ViewChild('resultsPane', { read: ElementRef }) private _resultsPane: ElementRef;
@ViewChild('queryLink', { read: ElementRef }) private _queryLinkElement: ElementRef;
constructor(
@Inject(forwardRef(() => ElementRef)) el: ElementRef,
@Inject(forwardRef(() => ChangeDetectorRef)) cd: ChangeDetectorRef,
@@ -404,6 +406,16 @@ export class QueryComponent extends GridParentComponent implements OnInit, OnDes
this.dataService.setEditorSelection(index);
}
onKey(e: Event, index: number) {
if (DOM.isAncestor(<HTMLElement>e.target, this._queryLinkElement.nativeElement) && e instanceof KeyboardEvent) {
let event = new StandardKeyboardEvent(e);
if (event.equals(KeyCode.Enter)) {
this.onSelectionLinkClicked(index);
e.stopPropagation();
}
}
}
/**
* Sets up the resize for the messages/results panes bar
*/