Skip to content

Commit 424c60f

Browse files
committed
Increase padding to target size to 20 and add comments
1 parent fa5deab commit 424c60f

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

aztec/src/main/kotlin/org/wordpress/aztec/AztecText.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -732,10 +732,16 @@ open class AztecText : AppCompatEditText, TextWatcher, UnknownHtmlSpan.OnUnknown
732732
x += scrollX
733733
y += scrollY
734734

735-
// Check if we're in the task list area
736-
if (isEnabled && x + totalPaddingStart <= (blockFormatter.listStyleLeadingMargin() + AztecTaskListSpan.PADDING_SPACE)) {
735+
// We check whether the user tap on a checkbox of a task list. The aztec text field should be enabled and we
736+
// check whether the tap event was on the leading margin which is where the checkbox is located plus a padding
737+
// space used to increase the target size for the tap event.
738+
if (isEnabled &&
739+
x + totalPaddingStart <= (blockFormatter.listStyleLeadingMargin() + AztecTaskListSpan.PADDING_SPACE)) {
737740
val line = layout.getLineForVertical(y)
738741
val off = layout.getOffsetForHorizontal(line, x.toFloat())
742+
// If the tap event was on the leading margin, we double check whether we are tapping on a task list item.
743+
// If that is true, then we return false because we don't want to propagate the tap event to stop moving
744+
// the cursor to the item tapped.
739745
if (getTaskListHandler()?.handleTaskListClick(
740746
text,
741747
off,

aztec/src/main/kotlin/org/wordpress/aztec/spans/AztecTaskListSpan.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ open class AztecTaskListSpan(
146146
override val textFormat: ITextFormat = AztecTextFormat.FORMAT_TASK_LIST
147147

148148
companion object {
149-
const val PADDING_SPACE = 15
149+
// Extra padding added to the target tap area for checkboxes.
150+
const val PADDING_SPACE = 20
150151
}
151152
}

0 commit comments

Comments
 (0)