Skip to content
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

Find widget and clipboard commands within webviews don't work; cannot search WebviewPanel with enableFindWidget: true; can't cut, copy or paste #1860

Open
2 tasks done
geekley opened this issue Apr 29, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@geekley
Copy link

geekley commented Apr 29, 2024

Describe the bug
Extensions can contribute custom editors, etc. using WebviewPanel. When one is created, WebviewPanelOptions can have enableFindWidget: true, which enables a find widget on the webview that can be used with CtrlF, just like in any browser.

In MS VSCode, it works as expected, even highlighting occurrences and everything.
In Codium, the find widget opens, but it doesn't work at all.

This is a problem, as extensions can often use webviews to display complex webpages, e.g. documentation; where often the user needs to be able to search for text. Forcing extension authors to implement custom search functionality just for Codium is not a viable option, as those webpages can often be from an external source like a website.

A place where you can easily see the issue is in "Show Release Notes", where the webview is not searchable in Codium.

Please confirm that this problem is VSCodium-specific

  • This bug doesn't happen if I use Microsoft's Visual Studio Code. It only happens in VSCodium.

Please confirm that the issue/resolution isn't already documented

To Reproduce
Simplest steps to quickly reproduce the behavior:

  1. Open an untitled markdown file and type a bunch of text.
  2. Click on 'Open Preview to the side'.
  3. Click on the preview and hit Ctrl+F to show the find widget.
  4. Search for some text, the use ENTER or the arrows.

Expected behavior
In MS VSCode, it works, finding the text, scrolling to it, and even highlighting all occurrences as you type on the search box.
In MS VSCode for the Web (testing an extension in a browser IDE with vscode-test-web), it works too, though it won't highlight occurrences.

In Codium, the find widget opens, but it doesn't work at all. Typing won't highlight occurrences, or enable the previous/next match arrow buttons. Enter doesn't find anything either.
Using the dev tools Console, and selecting the webview frame context, you can run JS API window.find just fine, so it's some issue involving the find widget itself, or possibly Chromium/Electron.

Screenshots
Codium:
Find widget in webview not working in Codium
MS VSCode:
Find widget in webview works in MS VSCode

Desktop (please complete the following information):

  • OS: Kubuntu 23.10, KDE Plasma v5.27.8, KDE Frameworks v5.110.0, Qt v5.15.10
  • Architecture: Linux v6.5.0-28-generic x64
  • Version: Codium 1.88.1; Browser: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) VSCodium/1.88.1 Chrome/120.0.6099.291 Electron/28.2.8 Safari/537.36
  • App Manager: Snap
  • Sandboxed: Snap

Additional context
Compared against the Flatpak version of MS VSCode v1.88.0 on the same machine:

Version: 1.88.0
Commit: 5c3e652f63e798a5ac2f31ffd0d863669328dc4c
Date: 2024-04-03T13:25:57.039Z
Electron: 28.2.8
ElectronBuildId: 27744544
Chromium: 120.0.6099.291
Node.js: 18.18.2
V8: 12.0.267.19-electron.0
OS: Linux x64 6.5.0-28-generic
@geekley geekley added the bug Something isn't working label Apr 29, 2024
@geekley
Copy link
Author

geekley commented Apr 29, 2024

Another bug: just found out that the Cut/Copy/Paste commands within a webview also don't work in Codium, though they do in MS VSCode. Tried the Copy command in both context menu and Ctrl+C shortcut.
To reproduce, test it in the same places described above.

@geekley geekley changed the title Find widget of webviews doesn't work; cannot search WebviewPanel with enableFindWidget: true Find widget and clipboard commands within webviews don't work; cannot search WebviewPanel with enableFindWidget: true; can't cut, copy or paste Apr 29, 2024
@daiyam
Copy link
Member

daiyam commented Apr 30, 2024

I can confirm the bug on macOS.

@geekley
Copy link
Author

geekley commented Apr 30, 2024

In case it helps, I just tested this (using extension API), it seems even manually executing commands like vscode.commands.executeCommand('editor.action.webvieweditor.findNext') and .findPrevious won't work.
These are the equivalent of the UI arrow buttons, it seems.
For context, commands editor.action.webvieweditor.showFind/.hideFind do work as expected.

@daiyam daiyam self-assigned this May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants