Skip to content

Commit a9f0251

Browse files
authored
Refactor "Modified in: User" indicator (microsoft#166645)
Ref microsoft#159088 The "Modified in: User" indicator is not like other indicators, because it doesn't put up a hover, and it has a link in the label itself. This PR refactors that indicator and clarifies that tab focus goes straight to the link when using keyboard navigation.
1 parent 44bfa31 commit a9f0251

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/vs/workbench/contrib/preferences/browser/settingsEditorSettingIndicators.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
import * as DOM from 'vs/base/browser/dom';
77
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
8-
import { IMouseEvent } from 'vs/base/browser/mouseEvent';
98
import { HoverPosition } from 'vs/base/browser/ui/hover/hoverWidget';
109
import { SimpleIconLabel } from 'vs/base/browser/ui/iconLabel/simpleIconLabel';
1110
import { RunOnceScheduler } from 'vs/base/common/async';
@@ -236,7 +235,7 @@ export class SettingsTreeIndicatorsLabel implements IDisposable {
236235
}
237236
}
238237

239-
updateScopeOverrides(element: SettingsTreeSettingElement, elementDisposables: DisposableStore, onDidClickOverrideElement: Emitter<ISettingOverrideClickEvent>, onApplyFilter: Emitter<string>) {
238+
updateScopeOverrides(element: SettingsTreeSettingElement, onDidClickOverrideElement: Emitter<ISettingOverrideClickEvent>, onApplyFilter: Emitter<string>) {
240239
this.scopeOverridesIndicator.element.innerText = '';
241240
this.scopeOverridesIndicator.element.style.display = 'none';
242241
if (element.hasPolicyValue) {
@@ -286,6 +285,7 @@ export class SettingsTreeIndicatorsLabel implements IDisposable {
286285
// just to click into the one override there is.
287286
this.scopeOverridesIndicator.element.style.display = 'inline';
288287
this.scopeOverridesIndicator.element.classList.remove('setting-indicator');
288+
this.scopeOverridesIndicator.element.removeAttribute('tabIndex');
289289
this.scopeOverridesIndicator.disposables.clear();
290290

291291
const prefaceText = element.isConfigured ?
@@ -295,8 +295,8 @@ export class SettingsTreeIndicatorsLabel implements IDisposable {
295295

296296
const overriddenScope = element.overriddenScopeList[0];
297297
const view = DOM.append(this.scopeOverridesIndicator.element, $('a.modified-scope', undefined, this.getInlineScopeDisplayText(overriddenScope)));
298-
elementDisposables.add(
299-
DOM.addStandardDisposableListener(view, DOM.EventType.CLICK, (e: IMouseEvent) => {
298+
this.scopeOverridesIndicator.disposables.add(
299+
DOM.addStandardDisposableListener(view, DOM.EventType.CLICK, (e) => {
300300
const [scope, language] = overriddenScope.split(':');
301301
onDidClickOverrideElement.fire({
302302
settingKey: element.setting.key,

src/vs/workbench/contrib/preferences/browser/settingsTree.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -885,7 +885,7 @@ export abstract class AbstractSettingRenderer extends Disposable implements ITre
885885
template.descriptionElement.innerText = element.description;
886886
}
887887

888-
template.indicatorsLabel.updateScopeOverrides(element, template.elementDisposables, this._onDidClickOverrideElement, this._onApplyFilter);
888+
template.indicatorsLabel.updateScopeOverrides(element, this._onDidClickOverrideElement, this._onApplyFilter);
889889

890890
const onChange = (value: any) => this._onDidChangeSetting.fire({
891891
key: element.setting.key,

0 commit comments

Comments
 (0)