Support scrollIntoView alignment options (#3952)

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
This commit is contained in:
Otger RoglaandJonathan Kelley authored and GitHub committed 2025-05-07 13:09:17 -07:00
1 parent 85b373deff
commit 28d38307a2
7 files changed
+79 -19

No files matched your search

+2 -2
View File
@@ -72,12 +72,12 @@ impl RenderedElementBacking for LiveviewElement {
fn scroll_to(
&self,
behavior: dioxus_html::ScrollBehavior,
options: dioxus_html::ScrollToOptions,
) -> std::pin::Pin<Box<dyn futures_util::Future<Output = dioxus_html::MountedResult<()>>>> {
let script = format!(
"return window.interpreter.scrollTo({}, {});",
self.id.0,
serde_json::to_string(&behavior).expect("Failed to serialize ScrollBehavior")
serde_json::to_string(&options).expect("Failed to serialize ScrollToOptions")
);
let fut = self.query.new_query::<bool>(&script).resolve();