Skip to content

Add Element.scrollIntoView and scrollIntoViewWithOptions#64

Merged
f-f merged 2 commits into
purescript-web:masterfrom
i-am-the-slime:add-element-scroll-into-view
May 31, 2026
Merged

Add Element.scrollIntoView and scrollIntoViewWithOptions#64
f-f merged 2 commits into
purescript-web:masterfrom
i-am-the-slime:add-element-scroll-into-view

Conversation

@i-am-the-slime
Copy link
Copy Markdown
Contributor

Binds the CSSOM View Element.scrollIntoView() and its options form, which web-dom doesn't currently expose.

  • scrollIntoView :: Element -> Effect Unit — the no-argument form.
  • scrollIntoViewWithOptions :: ScrollIntoViewOptions -> Element -> Effect Unit — with typed ScrollBehavior (Auto/Instant/Smooth) and ScrollLogicalPosition (Start/Center/End/Nearest).

The typed options are converted to the wire record via dedicated encoders (behaviorToString/logicalPositionToString), mirroring how attachShadow maps ShadowRootInit to its props record. Happy to adjust naming/shape to taste.

I'll add a CHANGELOG entry once a PR number is assigned.

Binds element.scrollIntoView() and the options form, with typed ScrollBehavior
(Auto/Instant/Smooth) and ScrollLogicalPosition (Start/Center/End/Nearest),
converted to the wire record by dedicated encoders (not Show).
Copy link
Copy Markdown

@f-f f-f left a comment

Choose a reason for hiding this comment

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

Thanks!

@f-f f-f merged commit 9b50c08 into purescript-web:master May 31, 2026
1 check passed
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.

2 participants