for #2491 - use a synthetic-focus class which is stronger than real focus, tho must be set manually as class

This commit is contained in:
Johannes Rieken
2016-01-28 16:19:28 +01:00
parent baaa42c0e9
commit e3c6a95d60
2 changed files with 14 additions and 1 deletions

View File

@@ -9,6 +9,7 @@ import 'vs/css!./inputBox';
import * as Bal from 'vs/base/browser/browser';
import * as dom from 'vs/base/browser/dom';
import * as browser from 'vs/base/browser/browserService';
import {IDisposable, disposeAll} from 'vs/base/common/lifecycle';
import {IHTMLContentElement} from 'vs/base/common/htmlContent';
import {renderHtml} from 'vs/base/browser/htmlContentRenderer';
import {IAction} from 'vs/base/common/actions';
@@ -70,6 +71,7 @@ export class InputBox extends Widget {
private showValidationMessage: boolean;
private state = 'idle';
private cachedHeight: number;
private disposables: IDisposable[] = [];
private _onDidChange = this._register(new Emitter<string>());
public onDidChange: Event<string> = this._onDidChange.event;
@@ -102,6 +104,10 @@ export class InputBox extends Widget {
this.input.setAttribute('autocorrect', 'off');
this.input.setAttribute('autocapitalize', 'off');
this.input.setAttribute('spellcheck', 'false');
this.disposables.push(
dom.addDisposableListener(this.input, dom.EventType.FOCUS, () => dom.addClass(this.element, 'synthetic-focus')),
dom.addDisposableListener(this.input, dom.EventType.BLUR, () => dom.removeClass(this.element, 'synthetic-focus')));
if (this.options.flexibleHeight) {
this.mirror = dom.append(wrapper, $('div.mirror'));
@@ -356,6 +362,7 @@ export class InputBox extends Widget {
public dispose(): void {
this._hideMessage();
this.disposables = disposeAll(this.disposables);
this.element = null;
this.input = null;