Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby

Bind touch events to drag handle only, not entire section

juan55ab9aed6e52
diff --git a/app/views/pages/dashboard.html.erb b/app/views/pages/dashboard.html.erb
index eecc59bf37..c89ebea168 100644
--- a/app/views/pages/dashboard.html.erb
+++ b/app/views/pages/dashboard.html.erb
@@ -46,9 +46,6 @@
data-action="
dragstart->dashboard-sortable#dragStart
dragend->dashboard-sortable#dragEnd
- touchstart->dashboard-sortable#touchStart
- touchmove->dashboard-sortable#touchMove
- touchend->dashboard-sortable#touchEnd
keydown->dashboard-sortable#handleKeyDown">
<div class="px-4 py-2 flex items-center justify-between">
<div class="flex items-center gap-2">
@@ -77,7 +74,12 @@
<% end %>
<button
type="button"
- class="cursor-grab active:cursor-grabbing text-secondary hover:text-primary transition-colors p-0.5 opacity-0 group-hover:opacity-100 hidden lg:block"
+ class="cursor-grab active:cursor-grabbing text-secondary hover:text-primary transition-colors p-0.5 lg:opacity-0 lg:group-hover:opacity-100"
+ data-dashboard-sortable-target="handle"
+ data-action="
+ touchstart->dashboard-sortable#touchStart
+ touchmove->dashboard-sortable#touchMove
+ touchend->dashboard-sortable#touchEnd"
aria-label="<%= t("pages.dashboard.drag_to_reorder") %>">
<%= icon("grip-vertical", size: "sm") %>
</button>