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

[Bug] CTRL+F / Find does not work for offscreen content #4760

Open
1 of 2 tasks
chadsowald opened this issue Nov 22, 2024 · 3 comments
Open
1 of 2 tasks

[Bug] CTRL+F / Find does not work for offscreen content #4760

chadsowald opened this issue Nov 22, 2024 · 3 comments
Labels
bug Issue identified by VS Code Team member as probable bug confirmed

Comments

@chadsowald
Copy link

Reproducible in vscode.dev or in VS Code Desktop?

  • Not reproducible in vscode.dev or VS Code Desktop

Reproducible in the monaco editor playground?

Monaco Editor Playground Link

The existing code in this existing sample demonstrates the issue:
https://microsoft.github.io/monaco-editor/playground.html?source=v0.52.0#example-extending-language-services-configure-javascript-defaults

Monaco Editor Playground Code

The existing code in this existing sample demonstrates the issue:
https://microsoft.github.io/monaco-editor/playground.html?source=v0.52.0#example-extending-language-services-configure-javascript-defaults

Reproduction Steps

  1. Visit
    https://microsoft.github.io/monaco-editor/playground.html?source=v0.52.0#example-extending-language-services-configure-javascript-defaults
  2. Press CTRL+F (or find in page, etc)
  3. Type 'jscode' (no quotes)

It seems that anything off screen isn't considered for built-in browser search. My React app has embedded Monaco editors too and I found this same bug. I don't think each app that embeds Monaco should have to hook into the browser find-in-page and try to do custom code.

Actual (Problematic) Behavior

Actual:
Only finds 1 instance of 'jscode'

Actual screenshot:
Image

Expected Behavior

Expected:
Should find 2 instances 'jscode'. If I scroll just a bit lower down and repeat, it finds both:
Image

Additional Context

Please refer to this blog post that has some commentary on find-in-page support these days:
https://textslashplain.com/2024/07/15/browser-features-find-in-page/

I noticed it pointed out https://developer.mozilla.org/en-US/docs/Web/CSS/content-visibility as one way to address this. Not sure if Monaco can make use of that?

@rzhao271 rzhao271 added bug Issue identified by VS Code Team member as probable bug confirmed labels Dec 18, 2024
@qirong77
Copy link

Why is this a bug?
As far as I understand, the Monaco Editor typically renders only about 30 lines of code to the DOM tree, depending on the size of the editor container. Consequently, the browser cannot search all the results because the full text is stored as a JavaScript string (or piece tree specifically). Only the portion of the text that is rendered to the DOM tree can be searched by the browser.

@chadsowald
Copy link
Author

@qirong77 It's a bug in the sense that the browser search is incomplete / inaccurate and it doesn't make sense for individual apps that embed Monaco to all have to separately fix/support search within Monaco.

Is your thinking that users can press CTRL+F within Monaco if that's where they expect the text to be that they're looking for? If so, I would say that works for more advanced users and only in some situations. Additionally, some apps may embed multiple Monaco editors on a single page and it might not be obvious even to an advanced user which editor may have the text they're searching for.

@qirong77
Copy link

@qirong77 It's a bug in the sense that the browser search is incomplete / inaccurate and it doesn't make sense for individual apps that embed Monaco to all have to separately fix/support search within Monaco.

Is your thinking that users can press CTRL+F within Monaco if that's where they expect the text to be that they're looking for? If so, I would say that works for more advanced users and only in some situations. Additionally, some apps may embed multiple Monaco editors on a single page and it might not be obvious even to an advanced user which editor may have the text they're searching for.

I got you , Monaco editors are designed to work with vscode, which operates with just one instance of the Monaco editor. Therefore, this issue may be beyond their usual scope of responsibilities, I guess.
Additionally, there's a known bug that many users, including us, encounter: having multiple editors with different themes on a single page, which still remains unfixed. 😂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug confirmed
Projects
None yet
Development

No branches or pull requests

3 participants