-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Fix going back in history to a search result page on firefox #72272
Fix going back in history to a search result page on firefox #72272
Conversation
I am utterly unable to say if this makes any kind of sense. JS shennanigans at this level is beyond my understanding. I'm prepared to trust you when you say it works, but I'm not in a position to build and test locally right now. |
I haven't been able to reproduce this issue locally. Is this a known Firefox bug? Are we even using |
The problem isn't on the JS side but on the browser side and seems to be specific to firefox. Like I said: the script isn't re-run unless we have the I recommend you to test locally with a little http server (and firefox!) to experience it: |
So I can confirm that I see this happen iff I use keyboard to navigate to a search result (i.e. down arrow and enter). If I use a mouse then it doesn't happen. This suggests there might be some kind of continuation of execution after the enter key press maybe, once the page is restarted with alt+left? |
src/librustdoc/html/static/main.js
Outdated
|
||
// This is required in firefox. Explanations: when going back in the history, firefox doesn't re-run | ||
// the JS, therefore preventing rustdoc from setting a few things required to be able to reload the | ||
// previous search results (if you clicked on a search result and came back). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After a long discussion on Discord, I'm okay providing:
// previous search results (if you clicked on a search result and came back). | |
// previous search results (if you navigated to a search result with the keyboard, | |
// pressed enter on it to navigate to that result, and then came back to this page). |
With a comment rework akin to my suggestion, r=me |
f867818
to
ed84780
Compare
It was a long but nice discussion. I learned a lot of things. :) I updated the comment, waiting for the CI and then let's go! Thanks for your reviews! |
@bors: r=kinnison |
📌 Commit ed84780 has been approved by |
…h-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
…h-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
…h-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
Rollup of 7 pull requests Successful merges: - rust-lang#71854 (Make `std::char` functions and constants associated to `char`.) - rust-lang#72111 (rustc-book: Document `-Z strip=val` option) - rust-lang#72272 (Fix going back in history to a search result page on firefox) - rust-lang#72296 (Suggest installing VS Build Tools in more situations) - rust-lang#72365 (Remove unused `StableHashingContext::node_to_hir_id` method) - rust-lang#72371 (FIX - Char documentation for unexperienced users) - rust-lang#72397 (llvm: Expose tiny code model to users) Failed merges: r? @ghost
Fix back-forward cache in rustdoc frontend Rustdoc's frontend set a no-op unload handler, specifically to disable Firefox's back-forward cache because it caused a bug. It's nice to allow the back-forward cache because it permits faster navigations. This change addresses the issues that were caused by back-forward cache. https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/1.5/Using_Firefox_1.5_caching https://web.dev/bfcache/ Demo: https://jacob.hoffman-andrews.com/rust/fix-bfcache/std/string/struct.String.html Related: rust-lang#72272
This bug was actually firefox not re-running JS script when you go back in history. To trigger it on the current docs:
Instead of having the search results, you'll see the normal doc page. You can find a small explanation about it here.
r? @kinnison
cc @ollie27