|
3 | 3 | * Licensed under the MIT License. See License.txt in the project root for license information. |
4 | 4 | *--------------------------------------------------------------------------------------------*/ |
5 | 5 |
|
6 | | -import * as nls from 'vs/nls'; |
7 | | -import * as strings from 'vs/base/common/strings'; |
| 6 | +import * as browser from 'vs/base/browser/browser'; |
8 | 7 | import * as dom from 'vs/base/browser/dom'; |
9 | | -import { TPromise } from 'vs/base/common/winjs.base'; |
10 | | -import { Widget } from 'vs/base/browser/ui/widget'; |
11 | | -import { Action } from 'vs/base/common/actions'; |
| 8 | +import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent'; |
12 | 9 | import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar'; |
13 | | -import { FindInput, IFindInputOptions } from 'vs/base/browser/ui/findinput/findInput'; |
14 | | -import { IMessage, HistoryInputBox } from 'vs/base/browser/ui/inputbox/inputBox'; |
15 | 10 | import { Button, IButtonOptions } from 'vs/base/browser/ui/button/button'; |
16 | | -import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent'; |
17 | | -import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; |
18 | | -import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; |
19 | | -import { ContextKeyExpr, IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey'; |
20 | | -import { IContextViewService } from 'vs/platform/contextview/browser/contextView'; |
| 11 | +import { FindInput, IFindInputOptions } from 'vs/base/browser/ui/findinput/findInput'; |
| 12 | +import { HistoryInputBox, IMessage } from 'vs/base/browser/ui/inputbox/inputBox'; |
| 13 | +import { Widget } from 'vs/base/browser/ui/widget'; |
| 14 | +import { Action } from 'vs/base/common/actions'; |
| 15 | +import { Delayer } from 'vs/base/common/async'; |
| 16 | +import { Emitter, Event } from 'vs/base/common/event'; |
21 | 17 | import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; |
22 | | -import { Event, Emitter } from 'vs/base/common/event'; |
23 | | -import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet'; |
24 | | -import { isSearchViewFocused, appendKeyBindingLabel } from 'vs/workbench/parts/search/browser/searchActions'; |
25 | | -import * as Constants from 'vs/workbench/parts/search/common/constants'; |
26 | | -import { attachInputBoxStyler, attachFindInputBoxStyler } from 'vs/platform/theme/common/styler'; |
27 | | -import { IThemeService } from 'vs/platform/theme/common/themeService'; |
| 18 | +import * as env from 'vs/base/common/platform'; |
| 19 | +import * as strings from 'vs/base/common/strings'; |
| 20 | +import { TPromise } from 'vs/base/common/winjs.base'; |
28 | 21 | import { CONTEXT_FIND_WIDGET_NOT_VISIBLE } from 'vs/editor/contrib/find/findModel'; |
| 22 | +import * as nls from 'vs/nls'; |
29 | 23 | import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService'; |
30 | 24 | import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; |
31 | | -import { IPanelService } from 'vs/workbench/services/panel/common/panelService'; |
| 25 | +import { ContextKeyExpr, IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; |
| 26 | +import { IContextViewService } from 'vs/platform/contextview/browser/contextView'; |
| 27 | +import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; |
| 28 | +import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; |
32 | 29 | import { ISearchConfigurationProperties } from 'vs/platform/search/common/search'; |
| 30 | +import { attachFindInputBoxStyler, attachInputBoxStyler } from 'vs/platform/theme/common/styler'; |
| 31 | +import { IThemeService } from 'vs/platform/theme/common/themeService'; |
33 | 32 | import { ContextScopedFindInput, ContextScopedHistoryInputBox } from 'vs/platform/widget/browser/contextScopedHistoryWidget'; |
34 | | -import { Delayer } from 'vs/base/common/async'; |
| 33 | +import { appendKeyBindingLabel, isSearchViewFocused } from 'vs/workbench/parts/search/browser/searchActions'; |
| 34 | +import * as Constants from 'vs/workbench/parts/search/common/constants'; |
| 35 | +import { IPanelService } from 'vs/workbench/services/panel/common/panelService'; |
| 36 | +import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet'; |
| 37 | +import { IEditorOptions } from 'vs/editor/common/config/editorOptions'; |
35 | 38 |
|
36 | 39 | export interface ISearchWidgetOptions { |
37 | 40 | value?: string; |
@@ -142,6 +145,7 @@ export class SearchWidget extends Widget { |
142 | 145 | this.updateAccessibilitySupport(); |
143 | 146 | } |
144 | 147 | }); |
| 148 | + browser.onDidChangeAccessibilitySupport(() => this.updateAccessibilitySupport()); |
145 | 149 | this.updateAccessibilitySupport(); |
146 | 150 | } |
147 | 151 |
|
@@ -244,9 +248,14 @@ export class SearchWidget extends Widget { |
244 | 248 | this.renderReplaceInput(this.domNode, options); |
245 | 249 | } |
246 | 250 |
|
| 251 | + private isScreenReaderOptimized() { |
| 252 | + const detected = browser.getAccessibilitySupport() === env.AccessibilitySupport.Enabled; |
| 253 | + const config = this.configurationService.getValue<IEditorOptions>('editor').accessibilitySupport; |
| 254 | + return config === 'on' || (config === 'auto' && detected); |
| 255 | + } |
| 256 | + |
247 | 257 | private updateAccessibilitySupport(): void { |
248 | | - const value = this.configurationService.getValue('editor.accessibilitySupport'); |
249 | | - this.searchInput.setFocusInputOnOptionClick(value !== 'on'); |
| 258 | + this.searchInput.setFocusInputOnOptionClick(!this.isScreenReaderOptimized()); |
250 | 259 | } |
251 | 260 |
|
252 | 261 | private renderToggleReplaceButton(parent: HTMLElement): void { |
|
0 commit comments