mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 19:21:50 +00:00
Previously, the behavior was different whether you clicked on the "Go to definition" link in the popover or used cmd-click. When using the link, the current location didn't get pushed into the browser history making "Go back" jump to a surprising location. When using cmd-click to navigate to a definition, we pushed the current location into the browser history to replicate the experience of navigating code in the editor where you can easily go up/down the "jump stack", which is the list of locations you navigate from/to with "Go to definition". Importantly, this PR preserves the HTML link in the popover so that users can still right-click "Open link in new tab". ## Test plan Manually tested with ``` ❯ SOURCEGRAPHDOTCOM_MODE=true SOURCEGRAPH_API_URL=https://sourcegraph.com sg start web-standalone ``` - Open URL https://sourcegraph.test:3443/github.com/sourcegraph/sourcegraph/-/blob/cmd/gitserver/server/server.go?L1080 - Load popover for `serverContext` on line 1093 - Click "Go to definition" - "Go back" in the browser history and verify that you go back to line 1093 (not 1080!) - Load the popover again for `serverContext` - Use cmd-click (or ctrl-click on Linux/Windows) on the "Go to definition" *link* and verify that it opens the definition in a new browser tab. Do the same for shift-click to open the link in a new window. - Load the popover again for `serverContext` - Verify that you can right-click on the "Go to definition" *link* and use "Open Link in New Tab" to open the definition location in a new browser tab Going back in history  <!-- All pull requests REQUIRE a test plan: https://docs.sourcegraph.com/dev/background-information/testing_principles --> ## App preview: - [Web](https://sg-web-olafurpg-definition-recover.onrender.com/search) Check out the [client app preview documentation](https://docs.sourcegraph.com/dev/how-to/client_pr_previews) to learn more. --------- Co-authored-by: Taras Yemets <yemets.taras@gmail.com> |
||
|---|---|---|
| .. | ||
| src | ||
| .eslintignore | ||
| .eslintrc.js | ||
| babel.config.js | ||
| BUILD.bazel | ||
| jest.config.js | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
Client API
Sourcegraph Client API