commit 8152a8c0f1b94950ce0d06c48501cc963d1e1731
parent cd974edc871195e731b8a6002848f442f57a4077
Author: Michael Camilleri <[email protected]>
Date: Sun, 8 Mar 2026 17:08:00 +0900
Prevent focus on drag-to-reorder
The text field in a task row will show an insertion point if the user is
holding on an area with text. This commit prevents that from occurring.
Co-Authored-By: Claude 4.6 Opus <[email protected]>
Diffstat:
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/ListlessiOS/Helpers/TappableTextField.swift b/ListlessiOS/Helpers/TappableTextField.swift
@@ -7,6 +7,7 @@ import UIKit
struct TappableTextField: UIViewRepresentable {
@Binding var text: String
let isCompleted: Bool
+ let isDragging: Bool
let onEditingChanged: (Bool, _ shouldCreateNewTask: Bool) -> Void
var returnKeyType: UIReturnKeyType = .done
var onContentChange: ((String) -> Void)? = nil
@@ -46,8 +47,8 @@ struct TappableTextField: UIViewRepresentable {
textView.returnKeyType = returnKeyType
textView.reloadInputViews()
}
- textView.isEditable = !isCompleted
- textView.isSelectable = !isCompleted
+ textView.isEditable = !isCompleted && !isDragging
+ textView.isSelectable = !isCompleted && !isDragging
if let placeholder = textView.viewWithTag(100) as? UILabel {
placeholder.isHidden = !text.isEmpty
}
diff --git a/ListlessiOS/Views/TaskRowView.swift b/ListlessiOS/Views/TaskRowView.swift
@@ -75,6 +75,7 @@ struct TaskRowView: View {
TappableTextField(
text: $editingTitle,
isCompleted: task.isCompleted,
+ isDragging: isDragging,
onEditingChanged: { editing, shouldCreateNewTask in
// TappableTextField is UIKit-backed; defer state mutations to avoid
// "Modifying state during view update" warnings from SwiftUI.