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

Add a static scroll-margin-top to a footnote item #899

Merged
merged 3 commits into from
Jan 22, 2025

Conversation

joshfarrant
Copy link
Contributor

@joshfarrant joshfarrant commented Jan 21, 2025

Summary

Added a static scroll-margin-top to Footnote.Item. This allows a small (100px) amount of space to be present between the top of the viewport and the Footnote.Item when it is navigated to.

What should reviewers focus on?

  • Are you happy with the change, and the 100px value?

Steps to test:

  1. Open the "return links" example in the Footnotes docs
  2. Click the number [1]
  3. Observe that the associated footnote is scrolled to with an offset of 100px

Supporting resources (related issues, external links, etc):

Contributor checklist:

  • All new and existing CI checks pass
  • Tests prove that the feature works and covers both happy and unhappy paths
  • Any drop in coverage, breaking changes or regressions have been documented above
  • UI Changes contain new visual snapshots (generated by adding update snapshots label to the PR)
  • All developer debugging and non-functional logging has been removed
  • Related issues have been referenced in the PR description

Reviewer checklist:

  • Check that pull request and proposed changes adhere to our contribution guidelines and code of conduct
  • Check that tests prove the feature works and covers both happy and unhappy paths
  • Check that there aren't other open Pull Requests for the same update/change

Screenshots:

footnotes.mp4

Copy link

changeset-bot bot commented Jan 21, 2025

🦋 Changeset detected

Latest commit: 7e34303

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@primer/react-brand Patch
@primer/brand-primitives Patch
@primer/brand-e2e Patch
@primer/brand-fonts Patch
@primer/brand-config Patch
@primer/brand-storybook Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

github-actions bot commented Jan 21, 2025

🟢 No design token changes found

Copy link
Contributor

github-actions bot commented Jan 21, 2025

🟢 No visual differences found

Our visual comparison tests did not find any differences in the UI.

@joshfarrant joshfarrant marked this pull request as ready for review January 22, 2025 08:59
@joshfarrant joshfarrant requested a review from rezrah January 22, 2025 08:59
@@ -20,6 +20,10 @@
padding-inline-start: var(--base-size-12);
}

.FootnotesItem {
scroll-margin-top: 100px;
Copy link
Collaborator

Choose a reason for hiding this comment

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

To your question:

Are you happy with the change, and the 100px value?

Should this be different across viewports? 100px on mobile is quite a lot of offset, should it be half of that?

Copy link
Contributor Author

@joshfarrant joshfarrant Jan 22, 2025

Choose a reason for hiding this comment

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

It could probably be reduced a bit, but I don't know if it necessarily needs to be responsive.

Our AnchorNav, for example, is 72px tall on all viewports and I'm not sure if we have any nav bars taller than that. We could bring the value down to 80px, but probably no lower than that.

Copy link
Collaborator

Choose a reason for hiding this comment

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

👍 sounds good, thanks

Copy link
Collaborator

@rezrah rezrah left a comment

Choose a reason for hiding this comment

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

🙌

@rezrah
Copy link
Collaborator

rezrah commented Jan 22, 2025

Forgot to mention @joshfarrant, could you please add a changeset to this PR

@joshfarrant
Copy link
Contributor Author

Ah, great spot, thanks @rezrah

Changeset added, and margin reduced to 80px too

@joshfarrant joshfarrant merged commit bc24d7a into main Jan 22, 2025
17 checks passed
@joshfarrant joshfarrant deleted the joshfarrant/footnotes-scroll-margin branch January 22, 2025 14:46
@primer-css primer-css mentioned this pull request Jan 22, 2025
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.

2 participants