-
Notifications
You must be signed in to change notification settings - Fork 10
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
[Flock][Feature] - Ctrl+F support, finding text on a page (even when scrolled off screen) #29
Comments
I've noticed a couple tickets that you've filed where this question wasn't really answered. This is a very critical question. For example, the reason that The best that could probably be done is to create a partial shadow DOM that repeats all the text from the Flutter widget tree. But that's very complicated, probably has numerous edge cases, and might kill performance. The optimal answer for this problem is for browsers to expose an actual search API, which could then be leveraged by Flutter and app developers. But Flutter has no control over browser standards. |
Is there a specific change being provided @rensPols? You can definitely implement a Google docs style CTRL+F to search with the APIs available today. Just like Google docs though, this would need to be implemented by the app, as the content is not available via widgets and wouldn't make sense to be available to widgets for perf reasons. We've done this type of thing with window paste events. It is true that just relying on listeners can make it difficult to catch all events, but with the web package you can add top level handlers to the window, trap the event, and invoke whatever UI you need today without any changes to the engine or Flutter. Are you looking for guidance on how to accomplish that trap of the key? |
@jezell could we do an opt-in adjustment to |
Semantics nodes probably already serve that opt in purpose to some degree since they integrate with things like Text widgets already, but they face a few problems:
I think it's telling that apps like google docs which use a similar rendering architecture just reimplement the entire feature inside the app instead of relying on the browser search box. In google docs for example, you wouldn't want the ctrl+f to find text in menus, just content inside the document. Ultimately the only reasonable solution is probably for apps to implement this themselves, or to opt into a specialized framework that is designed for rendering documents and implements this itself. While I'm not sure there is a clear path toward making a universal solution that works with all the material widgets or all the widgets on pub.dev, providing a set of specialized document widgets that implement this functionality is definitely something that could be reasonably done. Nothing in the framework or engine prevents someone from building such a package on top of something like attributed_text or TextSpans and having it hook into the web package to intercept ctrl+f / cmd+f by default, show a UI, and allow people to jump between the matches. If there was a case for something in the box, maybe building a SearchableRegion that works in a similar fashion and then integrating it like SelectableRegions are integrated with the stock widgets like Selectables are could be a path. In the same way that Selectables don't magically support everything in the box, Searchables could provide a path to get there that is not too hard for people to use. |
Flutter Issue Ticket Link:
Insert a link to the existing Flutter issue ticket. You should only file a feature request with Flock if you've already tried to get the Flutter team to implement it, first.
Why didn't Flutter implement this?
They put it in the triage multiple times now, but this issue is open since sep 9, 2020 now and it is still not addressed.
Why does this belong in Flock?
CTRL+F is essential for the browser since users expect this feature to be present and work properly.
The text was updated successfully, but these errors were encountered: