-
Notifications
You must be signed in to change notification settings - Fork 29.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WebViewPanel.reveal doesn't focus the tab if already visible #48246
Comments
While not directly related I also noticed while listening for For example, you have 2 tabs in column 1 -- tab 1 (hidden) is the webview, and tab 2 (visible) is another file, and then you have a tab in column 2 that is currently active. If you click the close X on tab 2, which will cause the webview to become visible, but not become active, because the tab in col 2 is still active. No event gets fired. |
I can't repo this in the latest insiders: import * as vscode from 'vscode';
import { join } from 'path';
const catCounterViewType = 'catCounter';
export function activate(context: vscode.ExtensionContext) {
const cat = vscode.Uri.file(join(context.extensionPath,'media', 'cat.gif')).with({ scheme: 'vscode-resource' })
let panel: any;
let disposable = vscode.commands.registerCommand('cat.startCounting', () => {
if (!panel) {
panel = (vscode.window as any).createWebviewPanel(catCounterViewType, 'Cat Counter', vscode.ViewColumn.Three, { });
}
panel.reveal(vscode.ViewColumn.Three);
panel.webview.html = contentFor(cat, 0);
});
context.subscriptions.push(disposable);
}
function contentFor(cat: vscode.Uri, count: number) {
return `
<img src="${cat}" width="200" />
<b id='counter' style="font-family: 'Comic Sans MS'; font-size: 96px; color: hotpink;"></b>
<script>
const counter = document.getElementById('counter');
let count = ${count};
setInterval(() => {
const c = count++
counter.innerText = c;
window.parent.postMessage({ count: c }, '*');
}, 100)
</script>`;
} The webview always becomes active/focused after |
When I run that exact same code on the latest insiders I don't see the behavior you see. What OS are you on? I'm on Windows 10. |
Ok, I was testing on macos. Let me test on windows again. I also just pushed some fixed for view state events not being fired. Those should be in the next insiders build |
I just tested this on windows in the latest insiders build. All appears to be working now. Let me know if you still see this issue with the latest insiders |
When I have a WebViewPanel open and visible but not active in ViewColumn.Three and I call
WebViewPanel.reveal(ViewColumn.Three);
the panel doesn't become the active editor./cc @mjbvz
Originally from #43713 (comment)
The text was updated successfully, but these errors were encountered: