Skip to content

Adjust the scroll-margin-top for anchors on pages with the student nav. (hotfix of #3203) - #3205

Open
drgrice1 wants to merge 1 commit into
openwebwork:mainfrom
drgrice1:sticky-nav-scroll-margin-adjust-hotfix
Open

Adjust the scroll-margin-top for anchors on pages with the student nav. (hotfix of #3203)#3205
drgrice1 wants to merge 1 commit into
openwebwork:mainfrom
drgrice1:sticky-nav-scroll-margin-adjust-hotfix

Conversation

@drgrice1

@drgrice1 drgrice1 commented Sep 8, 2026

Copy link
Copy Markdown
Member

This makes the scroll-margin-top setting for elements with an id attribute (used as anchors via a URL fragment) account for the height of the student/problem nav if it is present on the page. Basically, the value of the --sticky-nav-height css variable is always added to the scroll-margin-top for these elements. If the sticky student/problem nav is present on the page, then JavaScript sets the value of that css variable to the height of the sticky nav plus 1rem. Thus when a URL fragment is used the id element is not obscured behind the sticky nav.

One place where this is prominent is when viewing a problem in a test from either the set detail page for the test when editing a set version for a user, or from the manual problem grader when grading a problem in a test.

@somiaj mentioned this in #3202, and I have observed this for a while now. Note that @somiaj adds outline: none to these test div elements with an id which also improves the initial appearance when the page loads.

…nav.

This makes the `scroll-margin-top` setting for elements with an `id`
attribute (used as anchors via a URL fragment) account for the height of
the student/problem nav if it is present on the page.  Basically, the
value of the `--sticky-nav-height` css variable is always added to the
`scroll-margin-top` for these elements.  If the sticky student/problem
nav is present on the page, then JavaScript sets the value of that css
variable to the height of the sticky nav plus `1rem`.  Thus when a URL
fragment is used the id element is not obscured behind the sticky nav.

One place where this is prominent is when viewing a problem in a test
from either the set detail page for the test when editing a set version
for a user, or from the manual problem grader when grading a problem in
a test.

@somiaj mentioned this in openwebwork#3202, and I have observed this for a while
now. Note that @somiaj adds `outline: none` to these test div elements
with an `id` which also improves the initial appearance when the page
loads.
@drgrice1
drgrice1 force-pushed the sticky-nav-scroll-margin-adjust-hotfix branch from 5f2489a to 372f31b Compare September 9, 2026 18:09
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