mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 09:08:48 +01:00
Refactor "Modified in: User" indicator (#166645)
Ref #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.
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
import { IMouseEvent } from 'vs/base/browser/mouseEvent';
|
||||
import { HoverPosition } from 'vs/base/browser/ui/hover/hoverWidget';
|
||||
import { SimpleIconLabel } from 'vs/base/browser/ui/iconLabel/simpleIconLabel';
|
||||
import { RunOnceScheduler } from 'vs/base/common/async';
|
||||
@@ -236,7 +235,7 @@ export class SettingsTreeIndicatorsLabel implements IDisposable {
|
||||
}
|
||||
}
|
||||
|
||||
updateScopeOverrides(element: SettingsTreeSettingElement, elementDisposables: DisposableStore, onDidClickOverrideElement: Emitter<ISettingOverrideClickEvent>, onApplyFilter: Emitter<string>) {
|
||||
updateScopeOverrides(element: SettingsTreeSettingElement, onDidClickOverrideElement: Emitter<ISettingOverrideClickEvent>, onApplyFilter: Emitter<string>) {
|
||||
this.scopeOverridesIndicator.element.innerText = '';
|
||||
this.scopeOverridesIndicator.element.style.display = 'none';
|
||||
if (element.hasPolicyValue) {
|
||||
@@ -286,6 +285,7 @@ export class SettingsTreeIndicatorsLabel implements IDisposable {
|
||||
// just to click into the one override there is.
|
||||
this.scopeOverridesIndicator.element.style.display = 'inline';
|
||||
this.scopeOverridesIndicator.element.classList.remove('setting-indicator');
|
||||
this.scopeOverridesIndicator.element.removeAttribute('tabIndex');
|
||||
this.scopeOverridesIndicator.disposables.clear();
|
||||
|
||||
const prefaceText = element.isConfigured ?
|
||||
@@ -295,8 +295,8 @@ export class SettingsTreeIndicatorsLabel implements IDisposable {
|
||||
|
||||
const overriddenScope = element.overriddenScopeList[0];
|
||||
const view = DOM.append(this.scopeOverridesIndicator.element, $('a.modified-scope', undefined, this.getInlineScopeDisplayText(overriddenScope)));
|
||||
elementDisposables.add(
|
||||
DOM.addStandardDisposableListener(view, DOM.EventType.CLICK, (e: IMouseEvent) => {
|
||||
this.scopeOverridesIndicator.disposables.add(
|
||||
DOM.addStandardDisposableListener(view, DOM.EventType.CLICK, (e) => {
|
||||
const [scope, language] = overriddenScope.split(':');
|
||||
onDidClickOverrideElement.fire({
|
||||
settingKey: element.setting.key,
|
||||
|
||||
@@ -885,7 +885,7 @@ export abstract class AbstractSettingRenderer extends Disposable implements ITre
|
||||
template.descriptionElement.innerText = element.description;
|
||||
}
|
||||
|
||||
template.indicatorsLabel.updateScopeOverrides(element, template.elementDisposables, this._onDidClickOverrideElement, this._onApplyFilter);
|
||||
template.indicatorsLabel.updateScopeOverrides(element, this._onDidClickOverrideElement, this._onApplyFilter);
|
||||
|
||||
const onChange = (value: any) => this._onDidChangeSetting.fire({
|
||||
key: element.setting.key,
|
||||
|
||||
Reference in New Issue
Block a user