Skip to content

Commit

Permalink
Scroll to top of worksheet group instead of middle
Browse files Browse the repository at this point in the history
Not smooth anymore but I don't think you can do that easily.
  • Loading branch information
danielchalmers committed Nov 26, 2023
1 parent 6d91b5d commit 98cce90
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@namespace JournalApp
@inject IDialogService DialogService
@inject IScrollManager ScrollManager
@inject IJSRuntime JSRuntime
@inject PageService PageService

<MudDialog DefaultFocus="DefaultFocus.None">
Expand Down Expand Up @@ -77,6 +78,6 @@

async Task GoToGroup(string key)
{
await ScrollManager.ScrollIntoViewAsync($"#worksheet-group-key-{key}", ScrollBehavior.Smooth);
await JSRuntime.InvokeVoidAsyncIgnoreErrors("scrollToElementInsideDialog", $"#worksheet-group-key-{key}");
}
}
6 changes: 6 additions & 0 deletions JournalApp/wwwroot/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@
<script src="_framework/blazor.webview.js" autostart="false"></script>
<script src="_content/MudBlazor/MudBlazor.min.js"></script>

<script>
window.scrollToElementInsideDialog = (elementSelector) => {
document.querySelector(".mud-dialog").scrollTop = document.querySelector(elementSelector).offsetTop;
}
</script>

</body>

</html>

0 comments on commit 98cce90

Please sign in to comment.