Skip to content

fix(legacy-html): prevent scroll jump when opening header pickers#773

Open
Sahilshrma31 wants to merge 1 commit intonodejs:mainfrom
Sahilshrma31:fix/legacy-picker-prevent-scroll-jump
Open

fix(legacy-html): prevent scroll jump when opening header pickers#773
Sahilshrma31 wants to merge 1 commit intonodejs:mainfrom
Sahilshrma31:fix/legacy-picker-prevent-scroll-jump

Conversation

@Sahilshrma31
Copy link
Copy Markdown

Description

Fixes an unintended page scroll jump when opening sticky header picker dropdowns in legacy HTML docs.

Validation

I reproduced and verified on a generated legacy HTML page (out/fs.html) and in browser behavior matching the reported scenario.

Reproduction steps

Open an API docs page.
Scroll to the middle of the page.
Open sticky header pickers (Table of contents, Index, Other versions, Options).

Before

Screen.Recording.2026-04-15.at.11.01.24.PM.mov

Opening a picker causes the page to jump upward unexpectedly.

After

Screen.Recording.2026-04-15.at.11.02.03.PM.mov

Opening a picker no longer changes scroll position; only the dropdown opens.

Related Issues

Fixes #764

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run node --run test and all tests passed.
  • I have check code formatting with node --run format & node --run lint.
  • I've covered new added functionality with unit tests if necessary.

@Sahilshrma31 Sahilshrma31 requested a review from a team as a code owner April 15, 2026 17:36
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 15, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
api-docs-tooling Ready Ready Preview Apr 15, 2026 5:37pm

Request Review

@cursor
Copy link
Copy Markdown

cursor bot commented Apr 15, 2026

PR Summary

Low Risk
Low risk: small client-side UI tweak limited to legacy HTML picker focus behavior, with a guarded fallback for browsers that don’t support preventScroll.

Overview
Prevents an unintended scroll jump when opening legacy HTML header picker dropdowns by focusing the first dropdown link with focus({ preventScroll: true }).

Adds a null check and a try/catch fallback to plain focus() for browsers that don’t support the preventScroll option.

Reviewed by Cursor Bugbot for commit d6a4bff. Bugbot is set up for automated code reviews on this repo. Configure here.

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.

[bug] Opening header picker dropdowns causes unintended page scroll jump

1 participant