Command Palette should steal focus from active webview...
See original GitHub issuehey there 👋
i ran into a weird one. i have an extension which presents a webview with a number of html button elements. when these buttons are clicked, they often run a command via executeCommand
which in turn prompts the user via showInputBox
.
when a user clicks, the button is focused, command is run, and the input box is shown prompting the user to enter some info. they enter text and press the <enter>
key to submit.
since the button on the webview is still focused, it receives the <enter>
key press and re-triggers the command. iow, <enter>
in the input box is re-routed to the focused html button element.
ideally, focus should be removed from a webview (or any of it’s children elements) once the user opens the command palette.
for now, i just call el.blur()
in my webview’s event handler which fixes the issue.
- VSCode Version: v1.28.2
- OS Version: macOS v10.13.6 (high sierra)
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:5 (4 by maintainers)
Top GitHub Comments
👋 I’m the new owner of all things quick-pick. I’m wondering if you’re still seeing this issue… it’s been 3 years.
I’m hitting the same issue with this. We have a webview that hosts react components, two of which trigger export and import commands (which then use the open file and save file dialogs). These commands can be triggered from the react webview buttons or the command palette. The following steps trigger this pretty easily.
From an accessibility standpoint I think that we would probably want the command palette to override current focus when popped up and then restore focus when closed but even stealing the focus and not giving it back after would be better than keyboard key going to both the webview and the command palette.