Skip to content

Fix chip text field focus synchronization - #202

Merged
dokar3 merged 3 commits into
mainfrom
fix-text-field-focus-state
Jul 22, 2026
Merged

Fix chip text field focus synchronization#202
dokar3 merged 3 commits into
mainfrom
fix-text-field-focus-state

Conversation

@dokar3

@dokar3 dokar3 commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Fix #174

Summary by CodeRabbit

  • Bug Fixes

    • Improved text-field focus handling for more reliable focus requests and UI state updates.
    • Ensured repeated requests to focus the text field are processed consistently.
  • Tests

    • Added coverage for synchronizing focus state with the UI.
    • Added coverage for repeated text-field focus requests.

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@dokar3, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 30 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8f7cdbc2-591d-41f7-92da-303d1ef6c6a9

📥 Commits

Reviewing files that changed from the base of the PR and between 465274a and b55bfea.

📒 Files selected for processing (3)
  • chiptextfield-core/src/commonMain/kotlin/com/dokar/chiptextfield/BasicChipTextField.kt
  • chiptextfield-core/src/commonMain/kotlin/com/dokar/chiptextfield/ChipTextFieldState.kt
  • chiptextfield-core/src/commonTest/kotlin/com/dokar/chiptextfield/ChipTextFieldStateTest.kt
📝 Walkthrough

Walkthrough

The focus model now tracks UI focus separately and emits uniquely identified focus requests. BasicChipTextField consumes these requests and updates state from focus callbacks. Common tests and Kotlin test support were added.

Changes

Text-field focus synchronization

Layer / File(s) Summary
Focus request state model
chiptextfield-core/src/commonMain/kotlin/com/dokar/chiptextfield/ChipTextFieldState.kt, chiptextfield-core/src/commonTest/..., chiptextfield-core/build.gradle
ChipTextFieldState now stores uniquely identified focus requests and separate UI focus state; common tests verify synchronization and repeated focus requests.
Focus request UI integration
chiptextfield-core/src/commonMain/kotlin/com/dokar/chiptextfield/BasicChipTextField.kt
BasicChipTextField collects focus requests and updates state focus tracking from input focus changes.

Estimated code review effort: 3 (Moderate) | ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 30.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: fixing chip text field focus synchronization.
Linked Issues check ✅ Passed The focus state is now kept in sync with UI focus changes and repeated focus requests can emit distinct events, matching #174.
Out of Scope Changes check ✅ Passed The extra test source set and Kotlin test dependency are support changes for the focus fix and stay within scope.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-text-field-focus-state

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@chiptextfield-core/src/commonMain/kotlin/com/dokar/chiptextfield/ChipTextFieldState.kt`:
- Around line 147-170: Change the focus-request flow between
ChipTextFieldState.updateTextFieldFocusRequest and BasicChipTextField so
requests are consumed as one-shot events rather than retained and replayed by
restarted effects. In
chiptextfield-core/src/commonMain/kotlin/com/dokar/chiptextfield/ChipTextFieldState.kt:147-170,
expose a consume-or-clear operation for textFieldFocusRequest; in
chiptextfield-core/src/commonMain/kotlin/com/dokar/chiptextfield/BasicChipTextField.kt:332-348,
consume each request after handling it while preserving the existing
focused/unfocused behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 12955f09-e577-401d-be91-6e34a73d9e7e

📥 Commits

Reviewing files that changed from the base of the PR and between c4fa3f3 and 465274a.

📒 Files selected for processing (4)
  • chiptextfield-core/build.gradle
  • chiptextfield-core/src/commonMain/kotlin/com/dokar/chiptextfield/BasicChipTextField.kt
  • chiptextfield-core/src/commonMain/kotlin/com/dokar/chiptextfield/ChipTextFieldState.kt
  • chiptextfield-core/src/commonTest/kotlin/com/dokar/chiptextfield/ChipTextFieldStateTest.kt

@dokar3
dokar3 merged commit c133d40 into main Jul 22, 2026
2 checks passed
@dokar3
dokar3 deleted the fix-text-field-focus-state branch July 22, 2026 11:12
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.

ChipTextFieldState.textFieldFocusState is not in sync with the UI, causing ChipTextFieldState.focusTextField to fail

1 participant