Skip to content

fix(filter): commit pending external text input when pressing Done - #148

Merged
dragonx943 merged 1 commit into
UsagiApp:develfrom
andryan0001:fix/filter-sheet-done-commit-text
Oct 18, 2026
Merged

dragonx943 merged 1 commit into
UsagiApp:develfrom
andryan0001:fix/filter-sheet-done-commit-text

Conversation

@andryan0001

Copy link
Copy Markdown
Contributor

Summary

  • The external/dynamic filter sheet (used by plugins like keiyoushi) only committed text-input fields on keyboard Enter (IME_ACTION_DONE) or focus loss.
  • Tapping the sheet's Done button dismissed the view immediately, so the EditText's focus-loss callback never ran and the typed value was silently discarded.
  • Done button handler now clears focus on the focused field before dismiss(), forcing the existing focus-loss commit to fire synchronously — identical behaviour to pressing Enter.

Root cause

In filter/ui/external/FilterAdapter.kt, textDelegate commits via setOnEditorActionListener(IME_ACTION_DONE) and setOnFocusChangeListener. The sheet's Done button (filter/ui/external/sheet/FilterSheetFragment.kt) called dismiss() directly, tearing the view down before the focus-loss path could run.

Fix

FilterSheetFragment.kt Done handler:

binding.buttonDone.setOnClickListener {
    binding.recyclerView.findFocus()?.clearFocus()
    dismiss()
}

This covers all cases: keyboard open, keyboard closed-but-focused, and already-unfocused (no-op).

Notes

  • No new dependencies, no README/info-file changes, performance-neutral — within CONTRIBUTING.md principles.
  • Change verified by inspection; compileDebugKotlin / CI build recommended to confirm before merge. Only FilterSheetFragment.kt changed (local build.yml/AGENTS.md intentionally left untracked).

🤖 Generated with Claude Code

The external/dynamic filter sheet only committed text fields on keyboard
Enter (IME_ACTION_DONE) or focus loss. Tapping the sheet's Done button
dismissed the view immediately, so the EditText's focus-loss callback never
ran and the typed value was lost.

Clear focus on the focused field before dismissing so the existing
focus-loss commit fires synchronously, matching the Enter behaviour.

Co-Authored-By: Hy3 <noreply@hy3.dev>
@dragonx943
dragonx943 merged commit 0823b21 into UsagiApp:devel Oct 18, 2026
2 checks passed
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.

2 participants