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

Suppress 'rtd-footer-container' if not being built on ReadTheDocs #2013

Closed
wants to merge 2 commits into from

Conversation

DocOtak
Copy link

@DocOtak DocOtak commented Oct 11, 2024

This PR attempts to fix #1794 and possibly #1238 by not including the rtd-footer-container div if the site is not being built on ReadTheDocs.

This uses the same {% if READTHEDOCS %} as the ethical ads html.

@DocOtak
Copy link
Author

DocOtak commented Oct 12, 2024

Two alternatives to this I think are either to give the rtd-footer-container a min-height of 1rem. Or set the bottom margin to 0. The negative top and bottom combined with the zero height of this div when there is no content has the effect of pulling the div 1rem bellow its parent's bottom.

edit: I think doing the min-height option might be more correct for what I think is intended

@Carreau Carreau added this to the 0.16.1 milestone Nov 4, 2024
Copy link
Collaborator

@Carreau Carreau left a comment

Choose a reason for hiding this comment

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

This looks good to me, I guess I don't really like magic variable for which are not defined anywhere, and would prefer isdefined(...) or similar. But I think this will do.

I've approved the workflow and will wait for tests to pass.

@Carreau
Copy link
Collaborator

Carreau commented Nov 4, 2024

I think I want @gabalafou review on this, and if

function initRTDObserver()

needs update as

document.getElementById("rtd-footer-container").append(...)

Risk raising null has not attribute append, but I'm no js expert.

I thinks some tests needs updating as they assume the div exists (when comparing to expected files)

Copy link
Collaborator

@Carreau Carreau left a comment

Choose a reason for hiding this comment

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

test files needs updates.

@DocOtak
Copy link
Author

DocOtak commented Nov 4, 2024

@Carreau I also don't like magic variables and had trouble figuring out where {% if READTHEDOCS %} even comes from. Would you prefer the min-height solution? It would leave the DOM untouched and still fix the scrolling issue.

@DocOtak
Copy link
Author

DocOtak commented Nov 7, 2024

I managed to get the test running locally, thank you so much for providing a devcontainer definition!

I'm not sure how this PR might affect #1398 since that does away with the need for this container div that is causing problems.

@Carreau
Copy link
Collaborator

Carreau commented Nov 7, 2024

Would you prefer the min-height solution? It would leave the DOM untouched and still fix the scrolling issue.

No, this solution is great; I just don't generally like those magical variables.

Don't worry about #1398 , it's been dormant for some time; and I think it's easy enough to adapt if the need arises.

Copy link
Collaborator

@Carreau Carreau left a comment

Choose a reason for hiding this comment

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

+1, just want some JS experts input, but if there is not answers in a week or so I think it's good to merge.

Copy link
Collaborator

@Carreau Carreau left a comment

Choose a reason for hiding this comment

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

+1, just want some JS experts input, but if there is not answers in a week or so I think it's good to merge.

Copy link

github-actions bot commented Nov 7, 2024

Coverage report

This PR does not seem to contain any modification to coverable code.

@gabalafou
Copy link
Collaborator

gabalafou commented Nov 11, 2024

I looked into this today, and discovered some important facts:

So I think the right way forward is to remove all of that code. I opened a pull request to do so:

If folks agree that that pull request is the right way forward, then we can close this pull request without merging.

Thank you for helping to make PyData Sphinx Theme better!

@DocOtak
Copy link
Author

DocOtak commented Nov 11, 2024

@gabalafou Even better than what I've done, definitely in favor of merging #2034 in favor of this.

@Carreau
Copy link
Collaborator

Carreau commented Nov 12, 2024

Closing in favor of #2034

@Carreau Carreau closed this Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Addition of a vertical scroll bar as a result of rtd-footer-container on none RTD hosted sites
3 participants