diff --git a/src/vs/workbench/contrib/preferences/browser/settingsEditorSettingIndicators.ts b/src/vs/workbench/contrib/preferences/browser/settingsEditorSettingIndicators.ts index a3d9411fb4650..23e401e4aa1e0 100644 --- a/src/vs/workbench/contrib/preferences/browser/settingsEditorSettingIndicators.ts +++ b/src/vs/workbench/contrib/preferences/browser/settingsEditorSettingIndicators.ts @@ -295,17 +295,25 @@ export class SettingsTreeIndicatorsLabel implements IDisposable { const overriddenScope = element.overriddenScopeList[0]; const view = DOM.append(this.scopeOverridesIndicator.element, $('a.modified-scope', undefined, this.getInlineScopeDisplayText(overriddenScope))); - this.scopeOverridesIndicator.disposables.add( - DOM.addStandardDisposableListener(view, DOM.EventType.CLICK, (e) => { - const [scope, language] = overriddenScope.split(':'); - onDidClickOverrideElement.fire({ - settingKey: element.setting.key, - scope: scope as ScopeString, - language - }); - e.preventDefault(); - e.stopPropagation(); - })); + const onClickOrKeydown = (e: UIEvent) => { + const [scope, language] = overriddenScope.split(':'); + onDidClickOverrideElement.fire({ + settingKey: element.setting.key, + scope: scope as ScopeString, + language + }); + e.preventDefault(); + e.stopPropagation(); + }; + this.scopeOverridesIndicator.disposables.add(DOM.addDisposableListener(view, DOM.EventType.CLICK, (e) => { + onClickOrKeydown(e); + })); + this.scopeOverridesIndicator.disposables.add(DOM.addDisposableListener(view, DOM.EventType.KEY_DOWN, (e) => { + const ev = new StandardKeyboardEvent(e); + if (ev.equals(KeyCode.Space) || ev.equals(KeyCode.Enter)) { + onClickOrKeydown(e); + } + })); } else { this.scopeOverridesIndicator.element.style.display = 'inline'; this.scopeOverridesIndicator.element.classList.add('setting-indicator'); diff --git a/src/vs/workbench/contrib/preferences/browser/settingsTree.ts b/src/vs/workbench/contrib/preferences/browser/settingsTree.ts index 31bd05ac769fd..67c586a1b7d00 100644 --- a/src/vs/workbench/contrib/preferences/browser/settingsTree.ts +++ b/src/vs/workbench/contrib/preferences/browser/settingsTree.ts @@ -63,6 +63,7 @@ import { ILanguageService } from 'vs/editor/common/languages/language'; import { ConfigurationScope } from 'vs/platform/configuration/common/configurationRegistry'; import { IUserDataProfilesService } from 'vs/platform/userDataProfile/common/userDataProfile'; import { defaultButtonStyles, getInputBoxStyle } from 'vs/platform/theme/browser/defaultStyles'; +import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent'; const $ = DOM.$; @@ -1078,12 +1079,23 @@ export class SettingComplexRenderer extends AbstractSettingRenderer implements I ? editLanguageSettingLabel : SettingComplexRenderer.EDIT_IN_JSON_LABEL; - template.elementDisposables.add(DOM.addDisposableListener(template.button, DOM.EventType.CLICK, () => { + const onClickOrKeydown = (e: UIEvent) => { if (isLanguageTagSetting) { this._onApplyFilter.fire(`@${LANGUAGE_SETTING_TAG}${plainKey}`); } else { this._onDidOpenSettings.fire(dataElement.setting.key); } + e.preventDefault(); + e.stopPropagation(); + }; + template.elementDisposables.add(DOM.addDisposableListener(template.button, DOM.EventType.CLICK, (e) => { + onClickOrKeydown(e); + })); + template.elementDisposables.add(DOM.addDisposableListener(template.button, DOM.EventType.KEY_DOWN, (e) => { + const ev = new StandardKeyboardEvent(e); + if (ev.equals(KeyCode.Space) || ev.equals(KeyCode.Enter)) { + onClickOrKeydown(e); + } })); this.renderValidations(dataElement, template);