Skip to content

Commit e279bd5

Browse files
authored
Rollup merge of #72272 - GuillaumeGomez:fix-back-on-page-with-search-behaviour, r=kinnison
Fix going back in history to a search result page on firefox This bug was actually firefox not re-running JS script when you go back in history. To trigger it on the current docs: * Make a search * Pick an element (which isn't on the same page as the current element!) * Go back in history Instead of having the search results, you'll see the normal doc page. You can find a small explanation about it [here](http://web.archive.org/web/20100428053932/http://www.firefoxanswer.com/firefox/672-firefoxanswer.html). r? @kinnison cc @ollie27
2 parents e2c05d1 + ed84780 commit e279bd5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/librustdoc/html/static/main.js

+6
Original file line numberDiff line numberDiff line change
@@ -2787,3 +2787,9 @@ function focusSearchBar() {
27872787
function defocusSearchBar() {
27882788
getSearchInput().blur();
27892789
}
2790+
2791+
// This is required in firefox. Explanations: when going back in the history, firefox doesn't re-run
2792+
// the JS, therefore preventing rustdoc from setting a few things required to be able to reload the
2793+
// previous search results (if you navigated to a search result with the keyboard, pressed enter on
2794+
// it to navigate to that result, and then came back to this page).
2795+
window.onunload = function(){};

0 commit comments

Comments
 (0)