Skip to content

Eliminating inconsistencies between BTF1, BTF2 and native iOS tap behavior#3229

Merged
Vladimir Mazunin (mazunin-v-jb) merged 1 commit into
jb-mainfrom
v.mazunin/CMP-10493-inconsistent-focus-behavior-between-BTFs
Jul 22, 2026
Merged

Eliminating inconsistencies between BTF1, BTF2 and native iOS tap behavior#3229
Vladimir Mazunin (mazunin-v-jb) merged 1 commit into
jb-mainfrom
v.mazunin/CMP-10493-inconsistent-focus-behavior-between-BTFs

Conversation

@mazunin-v-jb

@mazunin-v-jb Vladimir Mazunin (mazunin-v-jb) commented Jul 14, 2026

Copy link
Copy Markdown

Aligns tap/caret/context-menu behavior across BasicTextField(TextFieldValue) (BTF1), BasicTextField(TextFieldState) (BTF2) and native iOS.

Fixes:
https://youtrack.jetbrains.com/issue/CMP-10493

What has been aligned

BTF1 tap handling

  • The iOS caret snap (cupertinoSetCursorOffsetFocused) now runs on every tap outside selection, including the focusing tap

Context menu on tap (BTF1 + BTF2)

  • The menu now appears only on a tap into an already-focused field, the first tap in the unfocused field should not show the menu
  • The menu by tap appears only if after the tap caret does not move to another position in the text

iOS edit-menu freshness

  • The edit menu is now built from the latest request snapshot, so Select / Select All gating reads the current selection instead of a value the snapshot flow lagged behind on (fixed Select wrongly appearing after a double-tap word selection).

Testing

Manual. This should be tested by QA

Release Notes

Fixes - iOS

  • Fixed the caret not snapping to the nearest word boundary when tapping inside a word in an unfocused BasicTextField(TextFieldValue)
  • Fixed the context menu appearing incorrectly after a tap in BasicTextField(TextFieldValue) and BasicTextField(TextFieldState)

@mazunin-v-jb
Vladimir Mazunin (mazunin-v-jb) marked this pull request as draft July 15, 2026 12:19
@mazunin-v-jb
Vladimir Mazunin (mazunin-v-jb) force-pushed the v.mazunin/CMP-10493-inconsistent-focus-behavior-between-BTFs branch from 41b1c07 to 3418d7b Compare July 16, 2026 13:42
@mazunin-v-jb Vladimir Mazunin (mazunin-v-jb) changed the title Eliminating inconsistencies between BTF1, BTF2 and native iOS behavior Eliminating inconsistencies between BTF1, BTF2 and native iOS touch and long-press behavior Jul 16, 2026
@mazunin-v-jb Vladimir Mazunin (mazunin-v-jb) changed the title Eliminating inconsistencies between BTF1, BTF2 and native iOS touch and long-press behavior Eliminating inconsistencies between BTF1, BTF2 and native iOS tap behavior Jul 16, 2026
@mazunin-v-jb
Vladimir Mazunin (mazunin-v-jb) force-pushed the v.mazunin/CMP-10493-inconsistent-focus-behavior-between-BTFs branch from f489359 to 1f877ee Compare July 20, 2026 20:51
…t snapshot and adjust caret focusing behavior

BTF1: snap caret on focusing tap and show context menu only when the caret doesn't move

Removed redundant comment in `TextFieldSelectionState.ios.kt` and reverted caret behavior documentation in `TextFieldDelegate.skiko.kt`.
Adjusted context menu appearing behavior in BTF1 to BTF2

Aligned context menu appearing behavior in case when tap occurs on the unfocused textfield which was previously focused (BTF2)

Reverted BTF2 changes, aligned BTF1 caret by tap behavior to the BTF2

Refactor `determineCursorDesiredOffset` to simplify parameters (previous offset is not needed) and update related tests

Made tap focus behavior in BTF2 consistent with BTF1 and Native iOS behavior
@mazunin-v-jb
Vladimir Mazunin (mazunin-v-jb) force-pushed the v.mazunin/CMP-10493-inconsistent-focus-behavior-between-BTFs branch from 1f877ee to a005f2f Compare July 20, 2026 20:54
@mazunin-v-jb
Vladimir Mazunin (mazunin-v-jb) marked this pull request as ready for review July 20, 2026 21:18
}

@Test
fun determineCursorDesiredOffset_tap_on_the_caret_at_the_same_position() {

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test checked the incorrect logic (tap on the caret in the middle of the word doesn't snap the caret to word boundaries), so I had to change it

@mazunin-v-jb
Vladimir Mazunin (mazunin-v-jb) merged commit 34c0b07 into jb-main Jul 22, 2026
26 checks passed
@mazunin-v-jb
Vladimir Mazunin (mazunin-v-jb) deleted the v.mazunin/CMP-10493-inconsistent-focus-behavior-between-BTFs branch July 22, 2026 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants