Forward the configured value for editor.cursorBlinking (for accessibility purposes) (#168217)

Fixes #131941: Forward the configured value for `editor.cursorBlinking` (for accessibility purposes)
This commit is contained in:
Alexandru Dima 2022-12-07 09:25:01 +01:00 committed by GitHub
parent dd86970478
commit 78948c54d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 7 deletions

View file

@ -646,6 +646,9 @@ export class Repl extends FilterViewPane implements IHistoryNavigationWidget {
const config = this.configurationService.getValue<IDebugConfiguration>('debug'); const config = this.configurationService.getValue<IDebugConfiguration>('debug');
options.acceptSuggestionOnEnter = config.console.acceptSuggestionOnEnter === 'on' ? 'on' : 'off'; options.acceptSuggestionOnEnter = config.console.acceptSuggestionOnEnter === 'on' ? 'on' : 'off';
options.ariaLabel = localize('debugConsole', "Debug Console"); options.ariaLabel = localize('debugConsole', "Debug Console");
// We must respect some accessibility related settings
options.accessibilitySupport = this.configurationService.getValue<'auto' | 'off' | 'on'>('editor.accessibilitySupport');
options.cursorBlinking = this.configurationService.getValue<'blink' | 'smooth' | 'phase' | 'expand' | 'solid'>('editor.cursorBlinking');
this.replInput = this.scopedInstantiationService.createInstance(CodeEditorWidget, this.replInputContainer, options, getSimpleCodeEditorWidgetOptions()); this.replInput = this.scopedInstantiationService.createInstance(CodeEditorWidget, this.replInputContainer, options, getSimpleCodeEditorWidgetOptions());

View file

@ -1920,9 +1920,9 @@ class SCMInputWidget {
const fontFamily = this.getInputEditorFontFamily(); const fontFamily = this.getInputEditorFontFamily();
const fontSize = this.getInputEditorFontSize(); const fontSize = this.getInputEditorFontSize();
const lineHeight = this.computeLineHeight(fontSize); const lineHeight = this.computeLineHeight(fontSize);
// We respect the configured `editor.accessibilitySupport` setting to be able to have wrapping // We must respect some accessibility related settings
// even when a screen reader is attached.
const accessibilitySupport = this.configurationService.getValue<'auto' | 'off' | 'on'>('editor.accessibilitySupport'); const accessibilitySupport = this.configurationService.getValue<'auto' | 'off' | 'on'>('editor.accessibilitySupport');
const cursorBlinking = this.configurationService.getValue<'blink' | 'smooth' | 'phase' | 'expand' | 'solid'>('editor.cursorBlinking');
this.setPlaceholderFontStyles(fontFamily, fontSize, lineHeight); this.setPlaceholderFontStyles(fontFamily, fontSize, lineHeight);
@ -1945,7 +1945,8 @@ class SCMInputWidget {
overflowWidgetsDomNode, overflowWidgetsDomNode,
renderWhitespace: 'none', renderWhitespace: 'none',
dropIntoEditor: { enabled: true }, dropIntoEditor: { enabled: true },
accessibilitySupport accessibilitySupport,
cursorBlinking
}; };
const codeEditorWidgetOptions: ICodeEditorWidgetOptions = { const codeEditorWidgetOptions: ICodeEditorWidgetOptions = {
@ -2004,10 +2005,11 @@ class SCMInputWidget {
'scm.inputFontFamily', 'scm.inputFontFamily',
'editor.fontFamily', // When `scm.inputFontFamily` is 'editor', we use it as an effective value 'editor.fontFamily', // When `scm.inputFontFamily` is 'editor', we use it as an effective value
'scm.inputFontSize', 'scm.inputFontSize',
'editor.accessibilitySupport' 'editor.accessibilitySupport',
'editor.cursorBlinking'
]; ];
const onInputFontFamilyChanged = Event.filter( const onRelevantSettingChanged = Event.filter(
this.configurationService.onDidChangeConfiguration, this.configurationService.onDidChangeConfiguration,
(e) => { (e) => {
for (const setting of relevantSettings) { for (const setting of relevantSettings) {
@ -2019,17 +2021,19 @@ class SCMInputWidget {
}, },
this.disposables this.disposables
); );
this.disposables.add(onInputFontFamilyChanged(() => { this.disposables.add(onRelevantSettingChanged(() => {
const fontFamily = this.getInputEditorFontFamily(); const fontFamily = this.getInputEditorFontFamily();
const fontSize = this.getInputEditorFontSize(); const fontSize = this.getInputEditorFontSize();
const lineHeight = this.computeLineHeight(fontSize); const lineHeight = this.computeLineHeight(fontSize);
const accessibilitySupport = this.configurationService.getValue<'auto' | 'off' | 'on'>('editor.accessibilitySupport'); const accessibilitySupport = this.configurationService.getValue<'auto' | 'off' | 'on'>('editor.accessibilitySupport');
const cursorBlinking = this.configurationService.getValue<'blink' | 'smooth' | 'phase' | 'expand' | 'solid'>('editor.cursorBlinking');
this.inputEditor.updateOptions({ this.inputEditor.updateOptions({
fontFamily: fontFamily, fontFamily: fontFamily,
fontSize: fontSize, fontSize: fontSize,
lineHeight: lineHeight, lineHeight: lineHeight,
accessibilitySupport accessibilitySupport,
cursorBlinking
}); });
this.setPlaceholderFontStyles(fontFamily, fontSize, lineHeight); this.setPlaceholderFontStyles(fontFamily, fontSize, lineHeight);