Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
fix(composer): clear stale keyboard highlights during pointer navigation
zszz350b0e9c469fe
diff --git a/apps/desktop/src/features/chat/composer/ComposerModelList.tsx b/apps/desktop/src/features/chat/composer/ComposerModelList.tsxindex 486ef9ad7..e42ca717d 100644--- a/apps/desktop/src/features/chat/composer/ComposerModelList.tsx+++ b/apps/desktop/src/features/chat/composer/ComposerModelList.tsx@@ -53,6 +53,7 @@ export function ComposerModelList({autoCorrect="off"autoCapitalize="off"onChange={(event) => setQuery(event.target.value)}+ onBlur={() => setModelHighlight(-1)}/></label><div className="composer-model-list" ref={modelListRef}>@@ -68,7 +69,6 @@ export function ComposerModelList({data-model-index={index}className={`composer-plus-item composer-model-option ${modelHighlight === index ? "kb-active" : ""}`}title={`${providerDisplayName(provider)} · ${model.modelId}`}- onMouseMove={() => setModelHighlight(index)}onClick={() => void selectModel(provider, model.modelId)}><span className="composer-model-option-main">@@ -122,7 +122,6 @@ export function ComposerModelList({className={`composer-plus-item composer-model-option ${active ? "active" : ""} ${modelHighlight === index ? "kb-active" : ""}`}role="menuitemradio"aria-checked={active}- onMouseMove={() => setModelHighlight(index)}onClick={() => void selectModel(group.provider, model.modelId)}><span className="composer-model-option-main">diff --git a/apps/desktop/src/features/chat/composer/ComposerModelPicker.tsx b/apps/desktop/src/features/chat/composer/ComposerModelPicker.tsxindex ea5c0ae7a..d93cb6822 100644--- a/apps/desktop/src/features/chat/composer/ComposerModelPicker.tsx+++ b/apps/desktop/src/features/chat/composer/ComposerModelPicker.tsx@@ -104,7 +104,7 @@ export function ComposerModelPicker({</TooltipButton>)}>- <div className="composer-menu-root">+ <div className="composer-menu-root" onMouseMove={() => setModelHighlight(-1)} onMouseLeave={() => setModelHighlight(-1)}>{rootActions}<ComposerModelListt={t} query={query} setQuery={setQuery}diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.mdindex b820a20fe..fb9d381cc 100644--- a/docs/spec/06-delivery/04-e2e-test-plan.md+++ b/docs/spec/06-delivery/04-e2e-test-plan.md@@ -16686,6 +16686,8 @@ host-created files. The full app's file-preview viewer is covered separately.a message is accepted, at which point that model moves first.- Search immediately without expanding Other models; choose using keyboardnavigation. Expand Other models inline and verify no duplicate recent rows.+ Move from the third recent row to Other models, and tab out of search after+ arrow navigation: no stale keyboard highlight remains on a model row.Without history, all configured models are directly visible. Verify thinkingdefaults still follow the selected binding and manual same-model levels survive.- Create a new chat: it inherits the last actually used model. Reload local preferencesdiff --git a/scripts/e2e/composer-model-selection.tsx b/scripts/e2e/composer-model-selection.tsxindex 3b99537c7..da85fd21a 100644--- a/scripts/e2e/composer-model-selection.tsx+++ b/scripts/e2e/composer-model-selection.tsx@@ -108,6 +108,25 @@ globalThis.composerModelSelectionProbe = async () => {if (recentRows.length !== 3 || !recentRows[0].textContent?.includes("model-d") || !recentRows[2].textContent?.includes("model-b")) {throw new Error("The first model menu must show exactly the three most recent models in order");}+ recentRows[2].dispatchEvent(new MouseEvent("mousemove", { bubbles: true }));+ await settle();+ const otherModels = document.querySelector<HTMLButtonElement>(".composer-menu-root [aria-expanded]")!;+ otherModels.dispatchEvent(new MouseEvent("mousemove", { bubbles: true }));+ otherModels.focus();+ await settle();+ if (document.querySelector(".composer-model-list .kb-active")) {+ throw new Error("Moving from a recent model to Other models must clear stale keyboard highlight");+ }+ const keyboardSearch = document.querySelector<HTMLInputElement>(".composer-model-search input")!;+ keyboardSearch.focus();+ keyboardSearch.dispatchEvent(new KeyboardEvent("keydown", { key: "ArrowDown", bubbles: true }));+ await settle();+ if (!document.querySelector(".composer-model-list .kb-active")) throw new Error("Arrow navigation must highlight a model");+ otherModels.focus();+ // The offscreen window does not own OS focus; deliver the native focusout edge.+ keyboardSearch.dispatchEvent(new FocusEvent("focusout", { bubbles: true, relatedTarget: otherModels }));+ await settle();+ if (document.querySelector(".composer-model-list .kb-active")) throw new Error("Leaving search must clear keyboard highlight");recentRows[2].click();await settle();if (!document.querySelector(".composer-menu-root [role=menuitemradio]")?.textContent?.includes("model-d")) {