Skip to content
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

Merged
merged 3 commits into from
Aug 26, 2018

Conversation

kzys
Copy link
Contributor

@kzys kzys commented Aug 23, 2018

Fixes #52774

@rust-highfive
Copy link
Collaborator

Some changes occurred in HTML/CSS.

cc @GuillaumeGomez

@rust-highfive
Copy link
Collaborator

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.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 23, 2018
@GuillaumeGomez
Copy link
Member

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! 😉

@GuillaumeGomez
Copy link
Member

Ah hold on, nevermind! I didn't see you extended it, my bad. Reopening and reviewing.

if (elem && isHidden(elem.offsetParent)) {
var h3 = elem.parentNode.previousSibling;

if (h3.tagName !== 'H3') {
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Done at 1f441a0

}

var elem = document.getElementById(hash);
if (elem && isHidden(elem.offsetParent)) {
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

@GuillaumeGomez
Copy link
Member

Two nits to fix and it's good to go.

@ehuss
Copy link
Contributor

ehuss commented Aug 23, 2018

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.

@GuillaumeGomez
Copy link
Member

@ehuss This PR should fix it.

@GuillaumeGomez
Copy link
Member

@kzys Thanks a lot for your work!

@bors: r+ rollup

@bors
Copy link
Contributor

bors commented Aug 23, 2018

📌 Commit 1f441a0 has been approved by GuillaumeGomez

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 23, 2018
@ehuss
Copy link
Contributor

ehuss commented Aug 23, 2018

I tried this patch, it doesn't seem to work.

  • In the example of BufWriter, the flush link doesn't work because it is nested within a trait implementation, so it actually needs to check recursively up the parents (document.getElementById("method.flush").offsetParent.offsetParent.offsetParent).
  • In the example of hiding all methods, and then trying to click on the sidebar, the immediate offsetParent is null.
  • When using cross-page links, AFAIK these won't trigger. The same logic needs to be applied somewhere like autoCollapse to prevent them from being collapsed in the first place (or immediately reopen them).

@GuillaumeGomez
Copy link
Member

@ehuss: Thanks for your check!
@kzys: Can you fix these issues too please?

@bors: r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Aug 24, 2018
Doing the expansion on onhashchange seems too late.

Fixes rust-lang#48726
@kzys
Copy link
Contributor Author

kzys commented Aug 25, 2018

@ehuss The last change (2c61f3c) should address the issues you've mentioned.

For cross-page links, I couldn't reproduce the issue even before my fix. How did you check the behavior?

@ehuss
Copy link
Contributor

ehuss commented Aug 25, 2018

I tried a variety of things, and everything seems to work now! TYVM!!

@GuillaumeGomez
Copy link
Member

Thanks a lot again, let's get this in!

@bors: r+ rollup

@bors
Copy link
Contributor

bors commented Aug 25, 2018

📌 Commit 2c61f3c has been approved by GuillaumeGomez

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 25, 2018
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Aug 26, 2018
Automatically expand a section even after page load

Fixes rust-lang#52774
bors added a commit that referenced this pull request Aug 26, 2018
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
bors added a commit that referenced this pull request Aug 26, 2018
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
@bors bors merged commit 2c61f3c into rust-lang:master Aug 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants