Skip to content

Refine chat keyboard focus and IME scrolling - #46

Open
zcmx wants to merge 1 commit into
theblazehen:mainfrom
zcmx:fix/chat-keyboard-behavior
Open

Refine chat keyboard focus and IME scrolling#46
zcmx wants to merge 1 commit into
theblazehen:mainfrom
zcmx:fix/chat-keyboard-behavior

Conversation

@zcmx

@zcmx zcmx commented Aug 13, 2026

Copy link
Copy Markdown

Proposed behavior

This PR intentionally proposes a UX behavior change rather than treating the previous behavior as objectively incorrect. Some users may prefer the existing behavior where the composer opens automatically whenever a chat becomes active. The proposed policy is:

  • automatically focus the composer only when entering a newly created session;
  • keep existing and restored sessions unfocused;
  • when the user explicitly opens the keyboard, return the conversation to the latest content and keep the tail visible while the IME resizes the viewport.

Maintainers may prefer to keep the old policy or make this configurable; feedback on the behavior itself is welcome.

Problem

On phones, opening an existing chat could immediately show the keyboard and consume much of the viewport. Conversely, when the user opened the keyboard intentionally, the newest messages could remain off-screen or be covered during IME resize.

Changes

  • Add an explicit focusInput chat navigation argument with a safe default of false.
  • Set focusInput=true only for newly created sessions.
  • Consume the initial focus request once, so tab changes or keyboard dismissal do not reopen it.
  • Return the list to the tail when the IME opens and keep the latest content visible during resize.
  • Add route/focus and scroll-state regression tests.

Verification

  • Manually verified on a Samsung SM-A546E with the hardened build.
  • ChatScrollRestorationTest and ScreenChatRouteTest pass on the integrated branch.
  • git diff --check passes.

The clean main branch currently blocks local Android unit-test compilation because compileDebugJavaWithJavac targets JVM 17 while compileDebugKotlin targets JVM 21. The same targeted tests passed before extracting this commit onto the clean PR branch.

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.

1 participant