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 into view in TOC #8898

Merged
merged 1 commit into from
Jun 21, 2023
Merged

Fix scroll into view in TOC #8898

merged 1 commit into from
Jun 21, 2023

Conversation

MihkelAuv
Copy link
Contributor

Modern template should scroll last active list item into view:

const activeElements = tocContainer.querySelectorAll('li.active')
const lastActiveElement = activeElements[activeElements.length - 1]
if (lastActiveElement) {
lastActiveElement.scrollIntoView({ block: 'nearest' })
}

But currently, list items do not get the class "active" assigned. This PR fixes this.

@codecov
Copy link

codecov bot commented Jun 21, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.01 ⚠️

Comparison is base (1426d18) 77.00% compared to head (cf70059) 76.99%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8898      +/-   ##
==========================================
- Coverage   77.00%   76.99%   -0.01%     
==========================================
  Files         605      605              
  Lines       25036    25036              
==========================================
- Hits        19278    19277       -1     
- Misses       5758     5759       +1     

see 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor

@yufeih yufeih left a comment

Choose a reason for hiding this comment

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

Aha, nice catch!

@yufeih yufeih added the bug-fix Makes the pull request to appear in "Bug Fixes" section of the next release note label Jun 21, 2023
@yufeih yufeih merged commit 366934b into dotnet:main Jun 21, 2023
@MihkelAuv MihkelAuv deleted the fix-toc-scroll-into-view branch July 11, 2023 08:29
p-kostov pushed a commit to ErpNetDocs/docfx that referenced this pull request Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-fix Makes the pull request to appear in "Bug Fixes" section of the next release note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants