-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Prevent automatic page change when using history #75806
Prevent automatic page change when using history #75806
Conversation
Some changes occurred in HTML/CSS/JS. |
(rust_highfive has picked a reviewer for you, use r? to override) |
src/librustdoc/html/static/main.js
Outdated
elem.click(); | ||
getCurrentValue("rustdoc-go-to-only-result") === "true") | ||
{ | ||
if (!search.firstChild || search.firstChild.innerText !== getSearchLoadingText()) { |
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.
Why not add this to the conditions above?
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.
Good point.
6b9e892
to
6cb364c
Compare
Updated! |
var search = getSearchElement(); | ||
if (results.others.length === 1 | ||
&& getCurrentValue("rustdoc-go-to-only-result") === "true" | ||
&& (!search.firstChild || search.firstChild.innerText !== getSearchLoadingText())) |
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.
In what cases will !search.firstChild
happen?
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.
By default it's empty. So it's not empty when you already performed a search and "cancelled" it (meaning, you pressed ESC or remove all the content from the search input) or if there is the "loading search result" text when you arrive on the page with a search parameter in your URL.
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.
Does not look that straightforward to me but I understand after you explain.
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.
I'll add a comment then.
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.
Looks good to me.
I added an explanation on the condition. |
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.
Good and even clearer now.
@bors: r=pickfire rollup |
📌 Commit 76bd5b3 has been approved by |
⌛ Testing commit 76bd5b3 with merge 24d88da65e150c0f13e82c5cd213fcb3da348207... |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
💔 Test failed - checks-actions |
clang failed? O.o Well, I guess it's out of the scope of this PR so let's retry... @bors: retry |
⌛ Testing commit 76bd5b3 with merge 1b33cf01a8507e618751d974a1cbbf831d903873... |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
cc @rust-lang/infra |
💔 Test failed - checks-actions |
We're already on it. Zulip discussion. @bors retry |
Oh great! Thanks for the quick answer. :) |
Rollup of 10 pull requests Successful merges: - rust-lang#74730 (Hexagon libstd: update type defs) - rust-lang#75758 (Fixes for VxWorks) - rust-lang#75780 (Unconfuse Unpin docs a bit) - rust-lang#75806 (Prevent automatic page change when using history) - rust-lang#75818 (Update docs for SystemTime Windows implementation) - rust-lang#75837 (Fix font color for help button in ayu and dark themes) - rust-lang#75870 (Unify theme choices border color in ayu theme) - rust-lang#75875 (Shorten liballoc vec resize intra-doc link) - rust-lang#75953 (Fix swapped stability attributes for rustdoc lints) - rust-lang#75958 (Avoid function-scoping global variables) Failed merges: r? @ghost
Fixes #75774.