question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Command Palette should steal focus from active webview...

See original GitHub issue

hey 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:open
  • Created 5 years ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
TylerLeonhardtcommented, Oct 22, 2021

👋 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.

1reaction
IanMatthewHuffcommented, Nov 6, 2018

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.

  1. Click the export command webview button.
  2. Hit esc to close the export dialog (focus is still on the export webview button)
  3. Hit Ctrl-Shift-P and select the import command in the command palette and press enter
  4. First the export dialog pops up again (due to the enter key on the focused web element)
  5. Next the import dialog pops up (due to the enter key in the command palette)

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Making Remote Development Even Better - Visual Studio Code
You can enable tunneling directly from the VS Code UI. ... open the Command Palette (F1) and run the command Remote Tunnels: Connect...
Read more >
msedgewebview2 is stealing focus from Excel
Used Window Focus Logger from Adminscope to discover what keeps stealing focus when I'm running Excel (and won't give it back until I...
Read more >
chrome/browser/ui/views/frame/browser_view.cc - Google Git
become active. This can steal focus if the user has another window open. // already. On Chrome OS, changing focus makes a view...
Read more >
How do I contribute a command to the VS Code explorer title ...
How can I make it so that: The refresh preview command only shows up in the command palette when my webview is focused?...
Read more >
Fixed issues in prior versions of Photoshop - Adobe Support
Photoshop's 3D features will be removed in future updates. Users working with 3D are encouraged to explore Adobe's new Substance 3D ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found