From f28691a68aa2a2c927dab156e52b021199f199da Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 31 May 2026 00:18:11 +0000 Subject: [PATCH] #2074 fix: scope item drag to handle only, restoring list scroll MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously the .draggable() modifier was applied to the entire ElevatedCard, causing any vertical swipe on an item to start a reorder instead of scrolling the parent LazyColumn. Moving the modifier to the DragHandle icon means: - touch anywhere on the card body → list scrolls normally - touch the drag handle and swipe → item reorders immediately - long-press anywhere on the list → item reorders (unchanged via dragContainer) --- CHANGELOG.md | 4 ++++ .../keymapper/base/actions/ActionListItem.kt | 23 ++++++++++--------- .../base/trigger/TriggerKeyListItem.kt | 23 ++++++++++--------- 3 files changed, 28 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c0872a3650..01172559fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Unreleased +## Fixed + +- #2074 Scrolling the action or trigger list no longer accidentally moves items; reordering by drag now only activates from the drag handle or via long-press. + ## Changed - #1369 Add content descriptions to drag handles and custom "Move up"/"Move down" accessibility actions for trigger and action list items, improving TalkBack support for reordering. diff --git a/base/src/main/java/io/github/sds100/keymapper/base/actions/ActionListItem.kt b/base/src/main/java/io/github/sds100/keymapper/base/actions/ActionListItem.kt index 55b451082c..c8493d9604 100644 --- a/base/src/main/java/io/github/sds100/keymapper/base/actions/ActionListItem.kt +++ b/base/src/main/java/io/github/sds100/keymapper/base/actions/ActionListItem.kt @@ -82,16 +82,6 @@ fun ActionListItem( .heightIn(min = 48.dp) .height(IntrinsicSize.Min) .padding(start = 16.dp, end = 16.dp) - .draggable( - state = draggableState, - enabled = isDraggingEnabled, - orientation = Orientation.Vertical, - startDragImmediately = false, - onDragStarted = { offset -> - dragDropState?.onDragStart(index, offset) - }, - onDragStopped = { dragDropState?.onDragInterrupted() }, - ) .semantics { if (isReorderingEnabled) { customActions = buildList { @@ -130,7 +120,18 @@ fun ActionListItem( if (isReorderingEnabled) { Icon( - modifier = Modifier.size(24.dp), + modifier = Modifier + .size(24.dp) + .draggable( + state = draggableState, + enabled = isDraggingEnabled, + orientation = Orientation.Vertical, + startDragImmediately = true, + onDragStarted = { offset -> + dragDropState?.onDragStart(index, offset) + }, + onDragStopped = { dragDropState?.onDragInterrupted() }, + ), imageVector = Icons.Rounded.DragHandle, contentDescription = stringResource(R.string.drag_handle_for, model.text), tint = MaterialTheme.colorScheme.onSurface, diff --git a/base/src/main/java/io/github/sds100/keymapper/base/trigger/TriggerKeyListItem.kt b/base/src/main/java/io/github/sds100/keymapper/base/trigger/TriggerKeyListItem.kt index 854f145664..6370ac90b2 100644 --- a/base/src/main/java/io/github/sds100/keymapper/base/trigger/TriggerKeyListItem.kt +++ b/base/src/main/java/io/github/sds100/keymapper/base/trigger/TriggerKeyListItem.kt @@ -82,16 +82,6 @@ fun TriggerKeyListItem( .heightIn(min = 48.dp) .height(IntrinsicSize.Min) .padding(start = 16.dp, end = 16.dp) - .draggable( - state = draggableState, - enabled = isDraggingEnabled, - orientation = Orientation.Vertical, - startDragImmediately = false, - onDragStarted = { offset -> - dragDropState?.onDragStart(index, offset) - }, - onDragStopped = { dragDropState?.onDragInterrupted() }, - ) .semantics { if (isReorderingEnabled) { customActions = buildList { @@ -130,7 +120,18 @@ fun TriggerKeyListItem( if (isReorderingEnabled) { Icon( - modifier = Modifier.size(24.dp), + modifier = Modifier + .size(24.dp) + .draggable( + state = draggableState, + enabled = isDraggingEnabled, + orientation = Orientation.Vertical, + startDragImmediately = true, + onDragStarted = { offset -> + dragDropState?.onDragStart(index, offset) + }, + onDragStopped = { dragDropState?.onDragInterrupted() }, + ), imageVector = Icons.Rounded.DragHandle, contentDescription = stringResource(R.string.drag_handle_for, primaryText), tint = MaterialTheme.colorScheme.onSurface,