diff --git a/src/vs/base/browser/ui/findinput/findInput.ts b/src/vs/base/browser/ui/findinput/findInput.ts index 38a9adc6314..920dea98954 100644 --- a/src/vs/base/browser/ui/findinput/findInput.ts +++ b/src/vs/base/browser/ui/findinput/findInput.ts @@ -46,6 +46,7 @@ export class FindInput extends Widget { private placeholder: string; private validation: IInputValidator; private label: string; + private fixFocusOnOptionClickEnabled = true; private inputActiveOptionBorder: Color; private inputBackground: Color; @@ -146,6 +147,10 @@ export class FindInput extends Widget { this.caseSensitive.disable(); } + public setFocusInputOnOptionClick(value: boolean): void { + this.fixFocusOnOptionClickEnabled = value; + } + public setEnabled(enabled: boolean): void { if (enabled) { this.enable(); @@ -312,7 +317,7 @@ export class FindInput extends Widget { })); this._register(this.regex.onChange(viaKeyboard => { this._onDidOptionChange.fire(viaKeyboard); - if (!viaKeyboard) { + if (!viaKeyboard && this.fixFocusOnOptionClickEnabled) { this.inputBox.focus(); } this.setInputWidth(); @@ -329,7 +334,7 @@ export class FindInput extends Widget { })); this._register(this.wholeWords.onChange(viaKeyboard => { this._onDidOptionChange.fire(viaKeyboard); - if (!viaKeyboard) { + if (!viaKeyboard && this.fixFocusOnOptionClickEnabled) { this.inputBox.focus(); } this.setInputWidth(); @@ -343,7 +348,7 @@ export class FindInput extends Widget { })); this._register(this.caseSensitive.onChange(viaKeyboard => { this._onDidOptionChange.fire(viaKeyboard); - if (!viaKeyboard) { + if (!viaKeyboard && this.fixFocusOnOptionClickEnabled) { this.inputBox.focus(); } this.setInputWidth(); diff --git a/src/vs/editor/contrib/find/findWidget.ts b/src/vs/editor/contrib/find/findWidget.ts index 79fadb095b3..d164bf9d6fc 100644 --- a/src/vs/editor/contrib/find/findWidget.ts +++ b/src/vs/editor/contrib/find/findWidget.ts @@ -159,7 +159,12 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas if (e.layoutInfo) { this._tryUpdateWidgetWidth(); } + + if (e.accessibilitySupport) { + this.updateAccessibilitySupport(); + } })); + this.updateAccessibilitySupport(); this._register(this._codeEditor.onDidChangeCursorSelection(() => { if (this._isVisible) { this._updateToggleSelectionFindButton(); @@ -840,6 +845,8 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas findPart.appendChild(this._closeBtn.domNode); + this.updateAccessibilitySupport(); + return findPart; } @@ -959,6 +966,11 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas } })); } + + private updateAccessibilitySupport(): void { + const value = this._codeEditor.getConfiguration().accessibilitySupport; + this._findInput.setFocusInputOnOptionClick(value !== platform.AccessibilitySupport.Enabled); + } } interface ISimpleCheckboxOpts { diff --git a/src/vs/workbench/parts/search/browser/searchView.ts b/src/vs/workbench/parts/search/browser/searchView.ts index 010348ef4ad..99e34054fba 100644 --- a/src/vs/workbench/parts/search/browser/searchView.ts +++ b/src/vs/workbench/parts/search/browser/searchView.ts @@ -323,7 +323,7 @@ export class SearchView extends Viewlet implements IViewlet, IPanel { this._register(this.searchWidget.onSearchSubmit(() => this.onQueryChanged())); this._register(this.searchWidget.onSearchCancel(() => this.cancelSearch())); - this._register(this.searchWidget.searchInput.onDidOptionChange((viaKeyboard) => this.onQueryChanged(viaKeyboard))); + this._register(this.searchWidget.searchInput.onDidOptionChange(() => this.onQueryChanged(true))); this._register(this.searchWidget.onReplaceToggled(() => this.onReplaceToggled())); this._register(this.searchWidget.onReplaceStateChange((state) => { diff --git a/src/vs/workbench/parts/search/browser/searchWidget.ts b/src/vs/workbench/parts/search/browser/searchWidget.ts index 43b6eaa9dc4..0c4a874d4ba 100644 --- a/src/vs/workbench/parts/search/browser/searchWidget.ts +++ b/src/vs/workbench/parts/search/browser/searchWidget.ts @@ -136,6 +136,13 @@ export class SearchWidget extends Widget { this.replaceInputBoxFocused = Constants.ReplaceInputBoxFocusedKey.bindTo(this.contextKeyService); this._replaceHistoryDelayer = new Delayer(500); this.render(container, options); + + this.configurationService.onDidChangeConfiguration(e => { + if (e.affectsConfiguration('editor.accessibilitySupport')) { + this.updateAccessibilitySupport(); + } + }); + this.updateAccessibilitySupport(); } public focus(select: boolean = true, focusReplace: boolean = false, suppressGlobalSearchBuffer = false): void { @@ -237,6 +244,11 @@ export class SearchWidget extends Widget { this.renderReplaceInput(this.domNode, options); } + private updateAccessibilitySupport(): void { + const value = this.configurationService.getValue('editor.accessibilitySupport'); + this.searchInput.setFocusInputOnOptionClick(value !== 'on'); + } + private renderToggleReplaceButton(parent: HTMLElement): void { const opts: IButtonOptions = { buttonBackground: null,