Microsoft/vscode

Command to open view container doesn't toggle properly

Open

#194,816 创建于 2023年10月4日

在 GitHub 查看
 (2 评论) (0 反应) (1 负责人)TypeScript (10,221 fork)batch import
bughelp wantedwebview

仓库指标

Star
 (74,848 star)
PR 合并指标
 (平均合并 11小时 43分钟) (30 天内合并 1,000 个 PR)

描述

Does this issue occur when all extensions are disabled?: Yes/No

  • VS Code Version: 1.82
  • OS Version: macOS 13.5

Steps to Reproduce:

  1. contribute a sidebar webview via an extension
  2. trigger workbench.view.extension.my-view-container. this opens the webview
  3. trigger workbench.view.extension.my-view-container again. this should toggle focus back to the editor, but doesn't

https://github.com/microsoft/vscode/blob/4a0e77678c0295b518151ae2d706436bab96ef4f/src/vs/workbench/browser/parts/views/viewsService.ts#L380-L384

I think it's the !layoutService.hasFocus(part) piece that's causing problems. as far as I can tell, document.activeElement is the webview's iframe, but the iframe is not actually a child of the sidebar container, so the hasFocus (I think) always returns false.

贡献者指南