Skip to content

feat: adding logic to prevent auto scrolling to components which scr…#741

Merged
MatthewHawkins merged 2 commits intomainfrom
738-scrollintoview-inside-demo-iframes-scrolls-the-documentation-page
Feb 17, 2026
Merged

feat: adding logic to prevent auto scrolling to components which scr…#741
MatthewHawkins merged 2 commits intomainfrom
738-scrollintoview-inside-demo-iframes-scrolls-the-documentation-page

Conversation

@MatthewHawkins
Copy link
Copy Markdown
Member

…ollintoview

Copy link
Copy Markdown
Member

@hyyan hyyan left a comment

Choose a reason for hiding this comment

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

LGTM

@webforj/webforj-documentations Could someone check if scrolling is broken in any other demos because of this change?

@bbrennanbasis bbrennanbasis changed the title feat: addiong logic to prevent auto scrolling to components which scr… feat: adding logic to prevent auto scrolling to components which scr… Feb 13, 2026
Copy link
Copy Markdown
Member

@bbrennanbasis bbrennanbasis left a comment

Choose a reason for hiding this comment

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

@MatthewHawkins there's still an edge case present. I've detailed how to replicate it in my comment.

Comment on lines +227 to +236

const originalFocus = iframeWindow.HTMLElement.prototype.focus;
iframeWindow.HTMLElement.prototype.focus = function (options) {
originalFocus.call(this, { ...options, preventScroll: true });
};
}
} catch (error) {
// Silently ignore cross-origin errors
}
};
Copy link
Copy Markdown
Member

@bbrennanbasis bbrennanbasis Feb 13, 2026

Choose a reason for hiding this comment

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

Found a case where auto scrolling can still happen.

Replication Steps

  1. Add a focus() method to a field in DateFieldView
returnField.focus();
  1. Go to the page where that sample is shown
    http://localhost:8080/docs/components/fields/datefield

  2. Scroll down to where the ComponentDemo isn't visible

  3. Refresh the page

Expected behavior

Refreshing the page doesn't change where I was scrolled to.

Actual behavior

Refreshing the page jumps up to the ComponentDemo with the focus, then jumps back to where I was originally:

Recording.2026-02-13.101654.mp4

(Moving this ComponentDemo to the bottom of the page also reproduced the same behavior that was previously present for the Tree and RadioButton articles)

@MatthewHawkins MatthewHawkins self-assigned this Feb 17, 2026
@MatthewHawkins MatthewHawkins modified the milestone: 25.12 Feb 17, 2026
@MatthewHawkins MatthewHawkins merged commit ece5e2e into main Feb 17, 2026
2 checks passed
@MatthewHawkins MatthewHawkins deleted the 738-scrollintoview-inside-demo-iframes-scrolls-the-documentation-page branch February 17, 2026 23:57
cliebhardt pushed a commit that referenced this pull request Feb 23, 2026
…frames-scrolls-the-documentation-page

feat: adding logic to prevent auto scrolling to components which scr…
cliebhardt pushed a commit that referenced this pull request Feb 23, 2026
…frames-scrolls-the-documentation-page

feat: adding logic to prevent auto scrolling to components which scr…
cliebhardt pushed a commit that referenced this pull request Mar 7, 2026
…frames-scrolls-the-documentation-page

feat: adding logic to prevent auto scrolling to components which scr…
cliebhardt pushed a commit that referenced this pull request Mar 24, 2026
…frames-scrolls-the-documentation-page

feat: adding logic to prevent auto scrolling to components which scr…
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.

scrollIntoView inside demo iframes scrolls the documentation page RadioButton and Tree article jump to samples with programmed selected options

4 participants