fix(maestro): keep the keyboard in the list while previewing
Two mounts were taking focus out of the sidebar mid-walk: the render that put the multi-view on screen before the preview applied, and the render that restores the previous pane when a preview ends. Both now mount without focusing, so j/k keeps walking. Also marks the preview with a badge on the canvas and drops the close button from its tab.
This commit is contained in:
+10
-2
@@ -114,8 +114,9 @@ let previewTimer: number | undefined;
|
||||
function schedulePreview(sessionId: string | null, source: "key" | "hover"): void {
|
||||
clearTimeout(previewTimer);
|
||||
previewTimer = window.setTimeout(() => {
|
||||
showMultiView();
|
||||
ensureMultiView();
|
||||
mv?.previewSession(sessionId);
|
||||
updateShellRoute();
|
||||
}, PREVIEW_DELAY[source]);
|
||||
}
|
||||
|
||||
@@ -262,11 +263,18 @@ mv = createMultiView({
|
||||
onLayoutChange: scheduleSave,
|
||||
});
|
||||
let contentShowsMv = false;
|
||||
function showMultiView(): void {
|
||||
/** Put the multi-view in the content pane, without rendering it. A preview
|
||||
* renders once, on its own terms (`docs/PREVIEW.md`); a render here would
|
||||
* first re-mount the pane it is about to replace, and that mount takes the
|
||||
* keyboard away from the list being walked. */
|
||||
function ensureMultiView(): void {
|
||||
if (!contentShowsMv) {
|
||||
content.replaceChildren(mv.el);
|
||||
contentShowsMv = true;
|
||||
}
|
||||
}
|
||||
function showMultiView(): void {
|
||||
ensureMultiView();
|
||||
mv.render();
|
||||
updateShellRoute();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user