-
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
restore the page title after escaping out of a search #53405
Conversation
Some changes occurred in HTML/CSS. |
(rust_highfive has picked a reviewer for you, use r? to override) |
I have to admit that I never paid attention to it... From what I can see, the only cases for title change are:
Actually, does it change the document title correctly when you pick an item from the current page? |
Picking an item from the current page works fine when I tried it just now. But I noticed a different bug:
Bug: Title changes back to "Results for f" :( If search is the only thing other than a pageload that changes the title, like you said, maybe I can unconditionally stash the title once at the beginning, and only ever restore that particular string? I'll try that approach and rebase. |
This version is only two lines, but maybe you can help me make sure I'm not assuming too much about how the whole page is architected. I'm totally unfamiliar with this code in general :-D |
No problem, you did great. Two solutions in this situation:
|
Did you see the approach in 2075509. Let me know what you think of that one. |
Oh that's good too. You just set it once you arrive on the page so I assume it's all good. If it's ok for you then I'll r+ it. |
Yeah I think I'm OK with it as is, as long as we don't expect to do any fancy partial page loading shenanigans in the near future that'll make this incorrect? |
We'll think about it at this moment but nothing like this is scheduled for the moment. Thanks! @bors: r+ rollup |
📌 Commit 2075509 has been approved by |
…omez restore the page title after escaping out of a search Currently if I start a search in the docs, but then hit ESC, the "Results for..." title is still there in my browser tab. This is a simple attempt to fix that. I see that there's a separate `var previousTitle = document.title` thing happening in `startSearch()`, but as far as I can tell that's only related to the back stack? I'd also appreciate feedback on the right place to declare the `titleBeforeSearch` variable. Testing-wise, I've confirmed by hand that the tab title restores correctly after building with `./x.py doc --stage 1 src/libstd`, but nothing more involved than that. What else should I test?
Thanks for reviewing! |
…omez restore the page title after escaping out of a search Currently if I start a search in the docs, but then hit ESC, the "Results for..." title is still there in my browser tab. This is a simple attempt to fix that. I see that there's a separate `var previousTitle = document.title` thing happening in `startSearch()`, but as far as I can tell that's only related to the back stack? I'd also appreciate feedback on the right place to declare the `titleBeforeSearch` variable. Testing-wise, I've confirmed by hand that the tab title restores correctly after building with `./x.py doc --stage 1 src/libstd`, but nothing more involved than that. What else should I test?
Rollup of 17 pull requests Successful merges: - #53030 (Updated RELEASES.md for 1.29.0) - #53104 (expand the documentation on the `Unpin` trait) - #53213 (Stabilize IP associated constants) - #53296 (When closure with no arguments was expected, suggest wrapping) - #53329 (Replace usages of ptr::offset with ptr::{add,sub}.) - #53363 (add individual docs to `core::num::NonZero*`) - #53370 (Stabilize macro_vis_matcher) - #53393 (Mark libserialize functions as inline) - #53405 (restore the page title after escaping out of a search) - #53452 (Change target triple used to check for lldb in build-manifest) - #53462 (Document Box::into_raw returns non-null ptr) - #53465 (Remove LinkMeta struct) - #53492 (update lld submodule to include RISCV patch) - #53496 (Fix typos found by codespell.) - #53521 (syntax: Optimize some literal parsing) - #53540 (Moved issue-53157.rs into src/test/ui/consts/const-eval/) - #53551 (Avoid some Place clones.) Failed merges: r? @ghost
Currently if I start a search in the docs, but then hit ESC, the "Results for..." title is still there in my browser tab. This is a simple attempt to fix that. I see that there's a separate
var previousTitle = document.title
thing happening instartSearch()
, but as far as I can tell that's only related to the back stack? I'd also appreciate feedback on the right place to declare thetitleBeforeSearch
variable.Testing-wise, I've confirmed by hand that the tab title restores correctly after building with
./x.py doc --stage 1 src/libstd
, but nothing more involved than that. What else should I test?