-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Automatically expand a section even after page load #53626
Conversation
Some changes occurred in HTML/CSS. |
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @QuietMisdreavus (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
Already fixed in #53094. You can see it in action in nightly docs: https://doc.rust-lang.org/nightly/std/vec/struct.Vec.html#method.extend Thanks anyway! 😉 |
Ah hold on, nevermind! I didn't see you extended it, my bad. Reopening and reviewing. |
src/librustdoc/html/static/main.js
Outdated
if (elem && isHidden(elem.offsetParent)) { | ||
var h3 = elem.parentNode.previousSibling; | ||
|
||
if (h3.tagName !== 'H3') { |
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.
Please check if h3
exists before accessing tagName
.
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.
Thanks. Done at 1f441a0
src/librustdoc/html/static/main.js
Outdated
} | ||
|
||
var elem = document.getElementById(hash); | ||
if (elem && isHidden(elem.offsetParent)) { |
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.
offsetParent
can be null
, please check it before calling isHidden
.
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.
Ditto
Two nits to fix and it's good to go. |
Would it be possible to fix the issues listed in #48726? It looks like this is close, but doesn't seem to work on those examples. |
@ehuss This PR should fix it. |
📌 Commit 1f441a0 has been approved by |
I tried this patch, it doesn't seem to work.
|
Doing the expansion on onhashchange seems too late. Fixes rust-lang#48726
I tried a variety of things, and everything seems to work now! TYVM!! |
Thanks a lot again, let's get this in! @bors: r+ rollup |
📌 Commit 2c61f3c has been approved by |
Automatically expand a section even after page load Fixes rust-lang#52774
Rollup of 5 pull requests Successful merges: - #53043 (Improve unstable message display) - #53428 (libtest terse format: show how far in we are) - #53626 (Automatically expand a section even after page load) - #53651 (Add struct keyword doc) - #53706 (rustdoc: Fix gap on section anchor symbol when hovering.) Failed merges: - #53472 (Use FxHash{Map,Set} instead of the default Hash{Map,Set} everywhere in rustc.) r? @ghost
Rollup of 5 pull requests Successful merges: - #53043 (Improve unstable message display) - #53428 (libtest terse format: show how far in we are) - #53626 (Automatically expand a section even after page load) - #53651 (Add struct keyword doc) - #53706 (rustdoc: Fix gap on section anchor symbol when hovering.) Failed merges: - #53472 (Use FxHash{Map,Set} instead of the default Hash{Map,Set} everywhere in rustc.) r? @ghost
Fixes #52774