Skip to content

Fix ScrollSpy smooth scroll from nested link content#42673

Open
ShiroKSH wants to merge 1 commit into
twbs:mainfrom
ShiroKSH:fix/scrollspy-nested-smooth-scroll
Open

Fix ScrollSpy smooth scroll from nested link content#42673
ShiroKSH wants to merge 1 commit into
twbs:mainfrom
ShiroKSH:fix/scrollspy-nested-smooth-scroll

Conversation

@ShiroKSH

Copy link
Copy Markdown

Description

Fixes ScrollSpy smooth scrolling when a click originates from an element nested inside an anchor.

Motivation & Context

The delegated click handler read hash from the native event target. Nested elements do not have the anchor hash, so the section lookup failed and smooth scrolling was skipped. The handler now uses Bootstrap's selector-matched delegated target, and a regression test covers a nested span.

Type of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I have read the contributing guidelines
  • My code follows the code style of the project (npm run lint)
  • My change introduces changes to the documentation
  • I have added tests to cover my changes
  • All new and existing tests passed

@ShiroKSH
ShiroKSH requested a review from a team as a code owner July 14, 2026 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants