mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 04:46:08 +00:00
fix(agent): force clearing focus on a tap in the Agent conversation (#2769)
A tap on the conversation while the composer held focus could crash the app:
FocusManager.clearFocus() without force walks the focused chain for a custom
exit and throws IllegalArgumentException ("ActiveParent with no focused
child") when a parent is ActiveParent with no active child. The forced path
skips that walk and treats a missing child as cleared. Nothing in the Agent UI
sets a custom focus exit, so forcing changes no behaviour.
Co-authored-by: Jan Pokorny <4580066+JanPokorny@users.noreply.github.com>
This commit is contained in:
1 parent
c7cd2b55af
commit
8faaac3b89
1 file changed
+2
-1
@@ -292,7 +292,8 @@ private fun AgentPageContent(
|
||||
awaitEachGesture {
|
||||
awaitFirstDown(requireUnconsumed = false, pass = PointerEventPass.Initial)
|
||||
if (panel == AgentPanel.MODEL || panel == AgentPanel.USAGE) panel = AgentPanel.NONE
|
||||
if (composer.focused) focusManager.clearFocus()
|
||||
// Forced: the unforced path walks the focus chain and throws ("ActiveParent with no focused child") when a tap lands while focus is moving.
|
||||
if (composer.focused) focusManager.clearFocus(force = true)
|
||||
}
|
||||
},
|
||||
list, following = !readingBack, onRevise = { composer.open() }, onSent = toLatest,
|
||||
|
||||
Reference in new issue
Block a user