Skip to content

Conversation

@sehnryr
Copy link
Contributor

@sehnryr sehnryr commented Feb 9, 2025

Implement Element's scroll method https://developer.mozilla.org/en-US/docs/Web/API/Element/scroll.

Note that this method only works for "scrollable" elements (i.e. overflowing elements) (See 10. https://drafts.csswg.org/cssom-view/#dom-element-scroll)

Added 2 examples:

  • scroll_to_offset: programmatic scrolling
  • router_restore_scroll: restore scroll position with a contextually scoped scroll value

@sehnryr sehnryr requested a review from a team as a code owner February 9, 2025 19:18
@sehnryr sehnryr force-pushed the feat/scroll-to-offset branch from 606739c to 61669f3 Compare April 17, 2025 08:37
Copy link
Member

@jkelleyrtp jkelleyrtp left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@jkelleyrtp jkelleyrtp merged commit 85b373d into DioxusLabs:main May 7, 2025
16 of 17 checks passed
AnteDeliria pushed a commit to AnteDeliria/dioxus that referenced this pull request Jun 2, 2025
* feat(html): add `scroll` method to MountedData

* feat(desktop): implement `scroll` method for DesktopElement

* feat(liveview): implement `scroll` method for LiveviewElement

* feat(web): implement `scroll` method for web_sys::Element

* docs(examples): add new example for `scroll` method

* fix(web): remove unncecessary f64 cast (clippy)

* fix(interpreter): return missing boolean from js

* docs(example): unwrap result instead of discarding its error

* docs(examples): create scroll restoring example on routing

* fix clippy

---------

Co-authored-by: Jonathan Kelley <[email protected]>
AnteDeliria pushed a commit to AnteDeliria/dioxus that referenced this pull request Jul 23, 2025
* feat(html): add `scroll` method to MountedData

* feat(desktop): implement `scroll` method for DesktopElement

* feat(liveview): implement `scroll` method for LiveviewElement

* feat(web): implement `scroll` method for web_sys::Element

* docs(examples): add new example for `scroll` method

* fix(web): remove unncecessary f64 cast (clippy)

* fix(interpreter): return missing boolean from js

* docs(example): unwrap result instead of discarding its error

* docs(examples): create scroll restoring example on routing

* fix clippy

---------

Co-authored-by: Jonathan Kelley <[email protected]>
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