Skip to content

Commit 0f00633

Browse files
feat: Add mobile touch drag-and-drop support
Adds touch-based drag and drop for mobile devices using a long-press gesture. Features: - Long press (500ms) to pick up a card - Card floats above original position with drop/cancel buttons - Scroll horizontally while dragging to reach other columns - Drop button triggers the move confirmation dialog - Cancel button (X) returns card to original position - Visual feedback with haptic vibration - Login required to drag cards Technical details: - Uses custom touchDrag modifier for touch event handling - Dispatches native drag events for compatibility with existing drop handlers - All styling uses CSS custom properties for theme compatibility - Mobile-only: desktop drag behavior unchanged
1 parent 27aecf6 commit 0f00633

File tree

4 files changed

+468
-4
lines changed

4 files changed

+468
-4
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
node_modules
22
.discourse-site
3+
4+
# Local History extension backups
5+
.history/

common/common.scss

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,21 @@ html.kanban-active {
8282
display: flex;
8383
gap: 0 10px;
8484

85+
// Add invisible scroll space using pseudo-elements
86+
&::before {
87+
content: "";
88+
min-width: 100vw;
89+
height: 1px;
90+
flex-shrink: 0;
91+
}
92+
93+
&::after {
94+
content: "";
95+
min-width: 100vw;
96+
height: 1px;
97+
flex-shrink: 0;
98+
}
99+
85100
.discourse-kanban-list {
86101
background: var(--primary-100);
87102
border: 1px solid var(--primary-low);
@@ -113,6 +128,7 @@ html.kanban-active {
113128
overflow-y: scroll;
114129
padding: 0 8px;
115130
height: 100%;
131+
padding-bottom: 100vh; // Allow scrolling down to position cards at bottom
116132
}
117133

118134
.topic-card {
@@ -124,8 +140,14 @@ html.kanban-active {
124140
box-shadow: var(--primary-low) 0 3px 6px;
125141
border: 1px solid var(--primary-low);
126142

143+
// Prevent iOS/Android long-press text selection and callout menu
144+
user-select: none;
145+
-webkit-touch-callout: none;
146+
-webkit-tap-highlight-color: transparent;
147+
127148
&.dragging {
128-
background-color: var(--tertiary-low);
149+
opacity: 0.8 !important;
150+
box-shadow: 0 5px 15px rgb(0 0 0 / 0.3) !important;
129151
}
130152

131153
&.card-no-recent-activity {
@@ -264,3 +286,46 @@ ul.kanban-controls {
264286
}
265287
}
266288
}
289+
290+
// Mobile touch drag styles
291+
.kanban-dragging-clone {
292+
opacity: 0.8;
293+
box-shadow: 0 0 15px rgb(var(--primary-rgb) / 0.3);
294+
295+
// Preserve card padding when moved outside normal container
296+
padding: 10px !important;
297+
}
298+
299+
.kanban-drop-button {
300+
padding: 6px;
301+
font-size: 14px;
302+
font-weight: bold;
303+
color: var(--secondary);
304+
background-color: var(--success);
305+
border: none;
306+
border-radius: 4px;
307+
box-shadow: 0 2px 8px rgb(var(--primary-rgb) / 0.5);
308+
cursor: pointer;
309+
310+
&:hover {
311+
background-color: var(--success-hover);
312+
}
313+
}
314+
315+
.kanban-cancel-button {
316+
padding: 0;
317+
font-size: 18px;
318+
font-weight: bold;
319+
line-height: 26px;
320+
text-align: center;
321+
color: var(--secondary);
322+
background-color: var(--danger);
323+
border: none;
324+
border-radius: 50%;
325+
box-shadow: 0 2px 8px rgb(var(--primary-rgb) / 0.5);
326+
cursor: pointer;
327+
328+
&:hover {
329+
background-color: var(--danger-hover);
330+
}
331+
}

0 commit comments

Comments
 (0)