From e45b7a5a426802fb475b3a0856b80b313f2c9411 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Moreno?= Date: Thu, 28 Jul 2022 17:27:25 +0200 Subject: Tree keyboard navigation should not steal keybindings (#156575) fixes #155571 --- src/vs/platform/list/browser/listService.ts | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'src/vs') diff --git a/src/vs/platform/list/browser/listService.ts b/src/vs/platform/list/browser/listService.ts index 9716ea6dc75..2bd9c44b14d 100644 --- a/src/vs/platform/list/browser/listService.ts +++ b/src/vs/platform/list/browser/listService.ts @@ -189,7 +189,6 @@ class MultipleSelectionController extends Disposable implements IMultipleSele function toWorkbenchListOptions( accessor: ServicesAccessor, - container: HTMLElement, options: IListOptions, ): [IListOptions, IDisposable] { const configurationService = accessor.get(IConfigurationService); @@ -203,7 +202,7 @@ function toWorkbenchListOptions( mouseWheelScrollSensitivity: configurationService.getValue(mouseWheelScrollSensitivityKey), fastScrollSensitivity: configurationService.getValue(fastScrollSensitivityKey), multipleSelectionController: options.multipleSelectionController ?? disposables.add(new MultipleSelectionController(configurationService)), - keyboardNavigationEventFilter: createKeyboardNavigationEventFilter(container, keybindingService), + keyboardNavigationEventFilter: createKeyboardNavigationEventFilter(keybindingService), }; return [result, disposables]; @@ -244,7 +243,7 @@ export class WorkbenchList extends List { @IInstantiationService instantiationService: IInstantiationService ) { const horizontalScrolling = typeof options.horizontalScrolling !== 'undefined' ? options.horizontalScrolling : Boolean(configurationService.getValue(horizontalScrollingKey)); - const [workbenchListOptions, workbenchListOptionsDisposable] = instantiationService.invokeFunction(toWorkbenchListOptions, container, options); + const [workbenchListOptions, workbenchListOptionsDisposable] = instantiationService.invokeFunction(toWorkbenchListOptions, options); super(user, container, delegate, renderers, { @@ -384,7 +383,7 @@ export class WorkbenchPagedList extends PagedList { @IInstantiationService instantiationService: IInstantiationService ) { const horizontalScrolling = typeof options.horizontalScrolling !== 'undefined' ? options.horizontalScrolling : Boolean(configurationService.getValue(horizontalScrollingKey)); - const [workbenchListOptions, workbenchListOptionsDisposable] = instantiationService.invokeFunction(toWorkbenchListOptions, container, options); + const [workbenchListOptions, workbenchListOptionsDisposable] = instantiationService.invokeFunction(toWorkbenchListOptions, options); super(user, container, delegate, renderers, { keyboardSupport: false, @@ -517,7 +516,7 @@ export class WorkbenchTable extends Table { @IInstantiationService instantiationService: IInstantiationService ) { const horizontalScrolling = typeof options.horizontalScrolling !== 'undefined' ? options.horizontalScrolling : Boolean(configurationService.getValue(horizontalScrollingKey)); - const [workbenchListOptions, workbenchListOptionsDisposable] = instantiationService.invokeFunction(toWorkbenchListOptions, container, options); + const [workbenchListOptions, workbenchListOptionsDisposable] = instantiationService.invokeFunction(toWorkbenchListOptions, options); super(user, container, delegate, columns, renderers, { @@ -812,7 +811,7 @@ class TreeResourceNavigator extends ResourceNavigator { } } -function createKeyboardNavigationEventFilter(container: HTMLElement, keybindingService: IKeybindingService): IKeyboardNavigationEventFilter { +function createKeyboardNavigationEventFilter(keybindingService: IKeybindingService): IKeyboardNavigationEventFilter { let inChord = false; return event => { @@ -825,7 +824,7 @@ function createKeyboardNavigationEventFilter(container: HTMLElement, keybindingS return false; } - const result = keybindingService.softDispatch(event, container); + const result = keybindingService.softDispatch(event, event.target); if (result?.enterChord) { inChord = true; @@ -862,7 +861,7 @@ export class WorkbenchObjectTree, TFilterData = void> @IThemeService themeService: IThemeService, @IConfigurationService configurationService: IConfigurationService ) { - const { options: treeOptions, getTypeNavigationMode, disposable } = instantiationService.invokeFunction(workbenchTreeDataPreamble, container, options as any); + const { options: treeOptions, getTypeNavigationMode, disposable } = instantiationService.invokeFunction(workbenchTreeDataPreamble, options as any); super(user, container, delegate, renderers, treeOptions); this.disposables.add(disposable); this.internals = new WorkbenchTreeInternals(this, options, getTypeNavigationMode, options.overrideStyles, contextKeyService, listService, themeService, configurationService); @@ -903,7 +902,7 @@ export class WorkbenchCompressibleObjectTree, TFilter @IThemeService themeService: IThemeService, @IConfigurationService configurationService: IConfigurationService ) { - const { options: treeOptions, getTypeNavigationMode, disposable } = instantiationService.invokeFunction(workbenchTreeDataPreamble, container, options as any); + const { options: treeOptions, getTypeNavigationMode, disposable } = instantiationService.invokeFunction(workbenchTreeDataPreamble, options as any); super(user, container, delegate, renderers, treeOptions); this.disposables.add(disposable); this.internals = new WorkbenchTreeInternals(this, options, getTypeNavigationMode, options.overrideStyles, contextKeyService, listService, themeService, configurationService); @@ -950,7 +949,7 @@ export class WorkbenchDataTree extends DataTree extends Async @IThemeService themeService: IThemeService, @IConfigurationService configurationService: IConfigurationService ) { - const { options: treeOptions, getTypeNavigationMode, disposable } = instantiationService.invokeFunction(workbenchTreeDataPreamble, container, options as any); + const { options: treeOptions, getTypeNavigationMode, disposable } = instantiationService.invokeFunction(workbenchTreeDataPreamble, options as any); super(user, container, delegate, renderers, dataSource, treeOptions); this.disposables.add(disposable); this.internals = new WorkbenchTreeInternals(this, options, getTypeNavigationMode, options.overrideStyles, contextKeyService, listService, themeService, configurationService); @@ -1042,7 +1041,7 @@ export class WorkbenchCompressibleAsyncDataTree e @IThemeService themeService: IThemeService, @IConfigurationService configurationService: IConfigurationService ) { - const { options: treeOptions, getTypeNavigationMode, disposable } = instantiationService.invokeFunction(workbenchTreeDataPreamble, container, options as any); + const { options: treeOptions, getTypeNavigationMode, disposable } = instantiationService.invokeFunction(workbenchTreeDataPreamble, options as any); super(user, container, virtualDelegate, compressionDelegate, renderers, dataSource, treeOptions); this.disposables.add(disposable); this.internals = new WorkbenchTreeInternals(this, options, getTypeNavigationMode, options.overrideStyles, contextKeyService, listService, themeService, configurationService); @@ -1077,11 +1076,9 @@ function getDefaultTreeFindMode(configurationService: IConfigurationService) { function workbenchTreeDataPreamble | IAsyncDataTreeOptions>( accessor: ServicesAccessor, - container: HTMLElement, options: TOptions, ): { options: TOptions; getTypeNavigationMode: () => TypeNavigationMode | undefined; disposable: IDisposable } { const configurationService = accessor.get(IConfigurationService); - const keybindingService = accessor.get(IKeybindingService); const contextViewService = accessor.get(IContextViewService); const contextKeyService = accessor.get(IContextKeyService); const instantiationService = accessor.get(IInstantiationService); @@ -1107,7 +1104,7 @@ function workbenchTreeDataPreamble(treeExpandMode) === 'doubleClick'), -- cgit v1.2.3