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

Why can't multiple texts be highlighted on the same page? #252

Closed
gurkantuna opened this issue Jan 7, 2024 · 8 comments
Closed

Why can't multiple texts be highlighted on the same page? #252

gurkantuna opened this issue Jan 7, 2024 · 8 comments

Comments

@gurkantuna
Copy link

gurkantuna commented Jan 7, 2024

I liked this feature, but it only evaluates the first text element. For example sent the link in the your Issues tab.

https://github.com/WICG/scroll-to-text-fragment/issues#:~:text=opened

image

Is there any parameter or something else to specify same texts?

@gurkantuna gurkantuna changed the title Why are multiple texts not highlighted in the same page? Why can't multiple texts highlighted in the same page? Jan 7, 2024
@gurkantuna gurkantuna changed the title Why can't multiple texts highlighted in the same page? Why can't multiple texts be highlighted in the same page? Jan 7, 2024
@gurkantuna gurkantuna changed the title Why can't multiple texts be highlighted in the same page? Why can't multiple texts be highlighted on the same page? Jan 7, 2024
@tomayac
Copy link
Contributor

tomayac commented Jan 8, 2024

@gurkantuna
Copy link
Author

Thanks @tomayac but your comment is about the sentences. I was asking about a single word repeated multiple times in the content. For example, the link you posted has seven 'context' words but only one is highlighted. https://blog.chromium.org/2019/12/chrome-80-content-indexing-es-modules.html#:~:text=context

Don't you think this should highlight more than one word?

@tomayac
Copy link
Contributor

tomayac commented Jan 8, 2024

The algorithm searches for the first matching instance of the word (or word sequence). As I said, if you want to link to all instances, you'd have to hand-craft the URL so that it includes multiple text fragments separated by &.

@gurkantuna
Copy link
Author

gurkantuna commented Jan 8, 2024

@tomayac I'm trying to explain that the algorithm is incomplete, or at least of no use to me in its current form. As far as I understand, this feature is sentence-oriented and offered for short answers of a few words. However, I wanted to use it for both words and sentences, but there is no such option. Therefore you should extend the code to highlight the same word more than once.

I've used this feature on many websites, but I'm having to remove it from all of them after realizing it only works once for the entire content. I'm writing a module myself for a similar feature, and for exampple, for the word 'data', I think the way it should work is below.

search-ezgif com-optimize

@tomayac
Copy link
Contributor

tomayac commented Jan 8, 2024

This Issue is essentially asking the same as #107 and should be closed as a duplicate thereof. The feature request is valid, but as stated here and in the linked Issue, currently the only alternative is to manually create multiple text fragments, which may or may not work for all use cases.

@gurkantuna
Copy link
Author

gurkantuna commented Jan 8, 2024

@tomayac It's been almost four years since that 😲, but it seems like you still haven't planned it.

I added this feature thinking it would work this way in all the work I do, but now that I've removed it, I have to deal with all my customers now. That's why, as you see, I am writing a module and this unplanned work will take me all day. Sorry but it would be better if you implemented this instead of proposing to close this. Of course, you can close this if you want🤔

@bokand
Copy link
Collaborator

bokand commented Jan 8, 2024

I agree with @tomayac - this is a duplicate of #107 so I'll close in favor of that one.

This is a valid feature request but isn't the use case we were targeting when initially designing this feature. As such, it would require some additional thought and consideration (in addition to implementation work in browsers) so isn't something I'm planning to take up in the near term. I'm hoping to merge this feature into the HTML standard. Once that happens feature improvements can happen on this as they do by the usual process in HTML.

@bokand bokand closed this as not planned Won't fix, can't repro, duplicate, stale Jan 8, 2024
@gurkantuna
Copy link
Author

gurkantuna commented Jan 8, 2024

This is a valid feature request but isn't the use case we were targeting when initially designing this feature.

@bokand I wrote this in the post above because I predicted this.

As far as I understand, this feature is sentence-oriented and offered for short answers of a few words.

Your answer is more acceptable as it explains the reasons rather than ignoring the problem compared to others. Anyway, I already done my own business.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants