-
Notifications
You must be signed in to change notification settings - Fork 5.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
Fix broken flyout layout due to RTD addons upgrade #15485
Conversation
2e99129
to
4e58d6c
Compare
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.
Assuming that we'd notice it the input[name=mode]
things weren't gone in some cases, this is probably safe to merge
4e58d6c
to
6ebee1d
Compare
6ebee1d
to
293bd7f
Compare
Rodrigo still wanted to look into some other stuff, so I'm dismissing the approval for now.
0c42e98
to
847f9ee
Compare
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 guess the regexes could be combined into one or two in principle, but also fine with me for now
The docs ci build failing is an issue, though :-) |
847f9ee
to
c3f96ce
Compare
c3f96ce
to
ac5c14f
Compare
ac5c14f
to
8d4dc15
Compare
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.
For half of this I'm not 100% clear on why it becomes necessary, but this seems to improve the situation at least, so we can merge and take it from there.
RTD is no longer injecting certain HTML elements, such as the flyout menu, and they are replacing these components with addons (see: readthedocs/readthedocs.org#11474). Unfortunately, addons does not work out-of-the-box with the customizations we have implemented - specifically, having a fixed flyout menu at the bottom of the sidebar in our docs.
The issue is because we explicitly use certain CSS selectors (e.g.,
.rst-versions
) to determine where to place the flyout menu, and the current code relied on such selector and didn't properly handle cases where such selector would not be present, breaking the layout with a type error sincerstVersions
isnull
. And the same applies for other selectors that are removed in this PR.solidity/docs/_static/js/initialize.js
Line 26 in 4ab3e36
The addons are enabled by default in the RTD dashboard, and it appears that we cannot disable them, see: readthedocs/readthedocs.org#11474 (comment).
You can see the docs of this PR here: https://docs.soliditylang.org/en/rtd-docs-workaround/
And some old broken version here: https://docs.soliditylang.org/en/v0.8.27/ (check the browser console for the error)
Note that this PR does not resolve the layout issues for older versions; it only applies to new releases. To keep older versions somewhat usable, the
Flyout
option should be enabled in the RTD dashboard.The PR also introduces checks to safely access properties or call methods on potentially null or undefined objects.