feat: adding logic to prevent auto scrolling to components which scr…#741
Conversation
hyyan
left a comment
There was a problem hiding this comment.
LGTM
@webforj/webforj-documentations Could someone check if scrolling is broken in any other demos because of this change?
bbrennanbasis
left a comment
There was a problem hiding this comment.
@MatthewHawkins there's still an edge case present. I've detailed how to replicate it in my comment.
|
|
||
| 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 | ||
| } | ||
| }; |
There was a problem hiding this comment.
Found a case where auto scrolling can still happen.
Replication Steps
- Add a
focus()method to a field inDateFieldView
returnField.focus();-
Go to the page where that sample is shown
http://localhost:8080/docs/components/fields/datefield -
Scroll down to where the
ComponentDemoisn't visible -
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)
…frames-scrolls-the-documentation-page feat: adding logic to prevent auto scrolling to components which scr…
…frames-scrolls-the-documentation-page feat: adding logic to prevent auto scrolling to components which scr…
…frames-scrolls-the-documentation-page feat: adding logic to prevent auto scrolling to components which scr…
…frames-scrolls-the-documentation-page feat: adding logic to prevent auto scrolling to components which scr…
…ollintoview