split view header keyboard access

This commit is contained in:
Benjamin Pasero
2016-01-18 16:38:58 +01:00
parent 917a9ef13b
commit 2d4a748360
2 changed files with 40 additions and 6 deletions

View File

@@ -49,6 +49,8 @@ export class FindInput extends Widget {
private validation:IInputValidator;
private label:string;
private optionsKeyListener: () => void;
private regex:Checkbox;
private wholeWords:Checkbox;
private caseSensitive:Checkbox;
@@ -247,10 +249,8 @@ export class FindInput extends Widget {
// Arrow-Key support to navigate between options
let indexes = [this.caseSensitive.domNode, this.wholeWords.domNode, this.regex.domNode];
this.domNode.addEventListener(dom.EventType.KEY_DOWN, (e: KeyboardEvent) => {
this.optionsKeyListener = dom.addListener(this.domNode, dom.EventType.KEY_DOWN, (e: KeyboardEvent) => {
let event = new StandardKeyboardEvent(e);
let eventHandled = false;
if (event.equals(CommonKeybindings.LEFT_ARROW) || event.equals(CommonKeybindings.RIGHT_ARROW) || event.equals(CommonKeybindings.ESCAPE)) {
let index = indexes.indexOf(<HTMLElement>document.activeElement);
if (index >= 0) {
@@ -271,8 +271,7 @@ export class FindInput extends Widget {
indexes[newIndex].focus();
}
event.preventDefault();
event.stopPropagation();
dom.EventHelper.stop(event, true);
}
}
});
@@ -304,6 +303,15 @@ export class FindInput extends Widget {
private clearValidation(): void {
this.inputBox.hideMessage();
}
public dispose(): void {
if (this.optionsKeyListener) {
this.optionsKeyListener();
this.optionsKeyListener = null;
}
super.dispose();
}
}
interface IMatchCountOpts {