summaryrefslogtreecommitdiff
path: root/web/templates
diff options
context:
space:
mode:
Diffstat (limited to 'web/templates')
-rw-r--r--web/templates/partials/shopping-tab.html9
1 files changed, 7 insertions, 2 deletions
diff --git a/web/templates/partials/shopping-tab.html b/web/templates/partials/shopping-tab.html
index 06d2b56..e68876f 100644
--- a/web/templates/partials/shopping-tab.html
+++ b/web/templates/partials/shopping-tab.html
@@ -97,7 +97,7 @@
{{if .Grouped}}
<!-- Grouped View: Items by Store -->
{{range .Stores}}
- <section class="bg-panel backdrop-blur-sm rounded-xl p-4 sm:p-5 mb-6">
+ <section id="store-{{slug .Name}}" class="bg-panel backdrop-blur-sm rounded-xl p-4 sm:p-5 mb-6">
<div class="flex items-center justify-between mb-4">
<h2 class="text-xl font-medium text-white">{{.Name}}</h2>
<a href="/shopping/mode/{{.Name}}"
@@ -127,10 +127,15 @@
</div>
{{end}}
<!-- Inline Add Item -->
+ <!-- scroll: is not optional here. This form sits *inside* the swap
+ target, so submitting it replaces the form mid-request; without an
+ explicit scroll target the page lands at the bottom instead of
+ staying on the store you were adding to. Anchored to this store's
+ own section, which is re-rendered with the same id. -->
<form class="inline-add-form mt-3 flex gap-2"
hx-post="/shopping/add"
hx-target="#shopping-items-list"
- hx-swap="innerHTML">
+ hx-swap="innerHTML scroll:#store-{{slug .Name}}:top">
<input type="hidden" name="store" value="{{.Name}}">
<input type="hidden" name="grouped" value="true">
<input type="text" name="name" placeholder="Add to {{.Name}}..."