2

This is how the search looks like in chrome

I tried to make something like this but I meet some problems. I use Window.getSelection() to highlight all matches, and separate input to get user query. But it does not highlight all added ranges like Firefox do, and I cannot get focus on input and in the same time highlight found text.

I have problems with focus and highlighting.

This is what I currently have

I know that Chrome and Firefox and VS Code and Atom all have this feature, they have highlighting that belongs to user-selection, and they have highlighting that belongs to search results. They probably have independent Selection objects for search results and for user-selection. Is there any ready API for that or I need to try to implement it myself?

Thank you all)

0 Answers0