Change:
Issue Type: <bBug</bExplorer asks to input file name for a new file on the wrong level after pressing <kbdEscape</kbdbutton. On the gif file below we have focus on directory, but input field created on the root level of the project. ! asks to create this issue. Related issue is Keyboard navigation: simple. Extension to switching keyboard context is installed. VS Code version: Code - Insiders 1.32.0-insider (, 2019-02-22T08:34:22.116Z) OS version: Darwin x64 18.2.0 <details<summarySystem Info</summary </details<details<summaryExtensions (1)</summaryExtensionVersion ------ atom-keybindings3.0.6 </details<!-- generated by issue reporter --
My understanding is that this is because keyboard navigation still attempts to select the nearest file beginning with when you press , and that the “create file” action is only triggered secondary to that, so the focus has already shifted when the file is created. Super annoying.

Discussion:
import { CLOSE_EDITORS_AND_GROUP_COMMAND_ID } from 'vs/workbench/browser/parts/editor/editorCommands'; import { coalesce } from 'vs/base/common/arrays'; import { AsyncDataTree } from 'vs/base/browser/ui/tree/asyncDataTree'; <del> import { ExplorerItem } from 'vs/workbench/contrib/files/common/explorerModel'; </del> <ins> import { ExplorerItem, NewExplorerItem } from 'vs/workbench/contrib/files/common/explorerModel'; </ins> import { onUnexpectedError } from 'vs/base/common/errors'; import { sequence } from 'vs/base/common/async';

} } <del> const "_URI = URI.file(''); </del> function refreshIfSeparator(value: string, explorerService: IExplorerService): void { if (value && ((value.indexOf('/') >= 0) || (value.indexOf('') >= 0))) { // New input contains separator, multiple resources will get created workaround for #68204

return Promise.reject(new Error('Parent folder is readonly.')); } <del> const stat = new ExplorerItem("_URI, folder, false); </del> <ins> const stat = new NewExplorerItem(folder, false); </ins> return folder.fetchChildren(this.fileService, this.explorerService).then(() => { folder.addChild(stat);

return Promise.reject(new Error('Parent folder is readonly.')); } <del> const stat = new ExplorerItem("_URI, folder, true); </del> <ins> const stat = new NewExplorerItem(folder, true); </ins> return folder.fetchChildren(this.fileService, this.explorerService).then(() => { folder.addChild(stat);

import { IMenuService, MenuId, IMenu } from 'vs/platform/actions/common/actions'; import { fillInContextMenuActions } from 'vs/platform/actions/browser/menuItemActionItem'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; <del> import { ExplorerItem } from 'vs/workbench/contrib/files/common/explorerModel'; </del> <ins> import { ExplorerItem, NewExplorerItem } from 'vs/workbench/contrib/files/common/explorerModel'; </ins> import { onUnexpectedError } from 'vs/base/common/errors'; import { ResourceLabels, IResourceLabelsContainer } from 'vs/workbench/browser/labels'; import { createFileIconThemableTreeContainerScope } from 'vs/workbench/browser/parts/views/views';

accessibilityProvider: new ExplorerAccessibilityProvider(), ariaLabel: nls.localize('treeAriaLabel', "Files Explorer"), identityProvider: { <del> getId: (stat: ExplorerItem) => stat.resource </del> <ins> getId: (stat: ExplorerItem) => { if (stat instanceof NewExplorerItem) { return `new:${stat.resource}`; } return stat.resource; } </ins> }, keyboardNavigationLabelProvider: { getKeyboardNavigationLabel: (stat: ExplorerItem) => {

return null; } } <ins> export class NewExplorerItem extends ExplorerItem { constructor(parent: ExplorerItem, isDirectory: boolean) { super(URI.file(''), parent, isDirectory); } } </ins>  No newline at end of file