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

Fix scroll position for cross references links #813

Merged
merged 2 commits into from
Oct 17, 2024

Conversation

wallacekelly-da
Copy link
Contributor

You may have noticed a very annoying behavior when clicking on links within the Ledger API reference docs. For example, if you click on the link for the GetActiveContractsResponse message, the heading for that message is behind the navbar. It is very confusing for new users.

This PR makes a small CSS tweak to address that issue. Using jQuery, it dynamically adds the section CSS class to the spans which serve as the anchor for internal links.

I did look at trying to add that CSS class to the RST source file, but without success. I have also asked on StackOverflow.

Attached are videos showing before and after.

before.mov
after.mov

@wallacekelly-da wallacekelly-da marked this pull request as ready for review October 16, 2024 12:21
@wallacekelly-da wallacekelly-da requested review from a team as code owners October 16, 2024 12:21
Copy link
Contributor

@carrielaben-da carrielaben-da left a comment

Choose a reason for hiding this comment

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

LGTM

@yves-da
Copy link
Contributor

yves-da commented Oct 16, 2024

Oh nice!

This is however a general problem on docs.daml.com, see

Not sure how easy it would be to apply this fix generally 🤔

@wallacekelly-da
Copy link
Contributor Author

Not sure how easy it would be to apply this fix generally

@yves-da, with 91f6986 I changed the jQuery selector from span[id^=com-daml-ledger-api-v] to div.section > span.

  • The former selects spans whose ids start with com-daml-ledger-api-v.
  • The latter selects spans that are direct children of a div with the class section. This is the pattern that Sphinx uses, as described here.

With the new selector, the issue seems to be addressed site wide.

@wallacekelly-da wallacekelly-da changed the title Fix scroll position for internal links in LAPI reference docs Fix scroll position for cross references links Oct 17, 2024
@wallacekelly-da wallacekelly-da merged commit d46ff4a into main Oct 17, 2024
1 check passed
@wallacekelly-da wallacekelly-da deleted the wallace/fix-internal-link-scroll branch October 17, 2024 20:20
@yves-da
Copy link
Contributor

yves-da commented Oct 18, 2024

@wallacekelly-da thanks a lot for the fix 🎉

With the new selector, the issue seems to be addressed site wide.

I wasn't able to verify that for myself. However, since this is theme-only change CI didn't update docs.daml.com because of #758

So, I guess, we have to wait for another docs PR merge to check its effect 😒

@yves-da
Copy link
Contributor

yves-da commented Oct 18, 2024

And indeed, after docs/2.10.0 got updated from another PR, the improvement materialized for that version. Very nice 😆

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.

Misaligned viewport when using cross-referencing using roles
3 participants