CodeMirror Blob: override browser Cmd+F
Created by: olafurpg
Currently, users need to manually focus on the blob view to search through the contents of the blob view. It's not obvious that the focus state controls the behavior of Cmd+F. There are two alternative solutions that we could implement to address this issue:
- Auto-focus on the blob view: this has the benefit of making it still possible to use the built-in Cmd+F functionality by unfocusing the blob view, but it has the problem that it's easy to miss the focus state of the blob view and it's not obvious how to recover it.
- Override the browser Cmd+F functionality to only search via CodeMirror. This has the benefit of making it obvious how to search inside the file (via CodeMirror search), but it has the problem that it's not clear how users should trigger the built-in search functionality.
Related Slack discussions https://sourcegraph.slack.com/archives/C03PPPY5T6V/p1661248589303509?thread_ts=1661247389.478549&cid=C03PPPY5T6V
We agreed that the second option is the lesser evil so that's the approach we will try first.
-
https://github.com/sourcegraph/sourcegraph/pull/40739 -
Trigger CM search on Cmd+F when the search bar is focused