Skip to content

fix(vc-blade): give a save a focus target of its own (VCST-5670) - #370

Merged
maksimzinchuk merged 1 commit into
mainfrom
fix/VCST-5670-save-focus-target
Sep 23, 2026
Merged

maksimzinchuk merged 1 commit into
mainfrom
fix/VCST-5670-save-focus-target

Conversation

@maksimzinchuk

Copy link
Copy Markdown
Collaborator

Closes the last open item on VCST-5670, which QA reopened on 2026-09-02.

What was left

The two failures from that run are already fixed and shipped in 2.6.0-rc.1: the mod+\ shortcut with focus in the sidebar (#353) and self-disabling buttons (#355). Two items were not:

  1. Save had no target of its own. QA flagged it on both the 2026-08-26 and 2026-09-02 runs: the blade region's ref changed on every save (e10641 → e10809 → e11144), so the blade remounts and onMounted(focusIfLoose) picks the loose focus up. That is an accident of the consumer's implementation — the day a blade stops remounting on save, focus lands on <body> and nothing reports it.
  2. Acceptance item 2 — "the chosen target is documented per transition, so QA can assert it" — was only ever half done. Four transitions were written up in ticket comments; the two shortcut paths and the popup path were not written down anywhere.

Changes

vc-blade.vue — repair loose focus on the load transition itself:

watch(
  () => Boolean(props.loading),
  () => focusIfLoose(() => bladeRef.value),
);

Same shape as the two repairs already in the file. focusIfLoose declines when something live holds focus, so a user mid-edit is never yanked.

focus.docs.md — a table of all eight transitions: target, which code delivers it, and whether it is a repair (declines when focus is held) or a deliberate handoff (moves it because the node is about to be unmounted). Plus how to measure one, including why the Tab-once check proves nothing where the nav precedes main in DOM order.

Verification

  • vc-blade.focus.test.ts — two cases added. RED baseline taken: with the watch reverted, "takes focus when the save left it nowhere" fails and the other four still pass.
  • npx vitest run ui/components/organisms/vc-blade/ — 18 files, 178 tests, green.
  • Focus-adjacent suites (focus.test.ts, vc-app, vc-auth-layout, usePopup) — 27 files, 261 tests, green.
  • yarn typecheck clean, yarn docs:lint 0 errors, eslint --max-warnings=0 clean on the changed files.

Note for QA

vcmp-dev was serving 2.6.0-rc.0 at the last run. 2.6.0-rc.1 (published 2026-09-08 from cd4eeb6d6) already carries #353 and #355 — verified with git merge-base --is-ancestor. This PR is not in any published version yet.

Saving re-renders the toolbar, and the control the user activated can stop
existing. Nothing owned repairing that: a blade that happened to remount was
rescued by the mount repair, which is an accident of the consumer's code rather
than a guarantee, and it would have failed silently the day a blade stopped
remounting. QA flagged it twice on this ticket, on two separate builds, without
a ticket to carry it.

Repair the loose focus on the load transition itself, the same shape the other
two repairs in this file already use. It declines when something live holds
focus, so a user mid-edit is never yanked.

The remaining acceptance item was that the target is documented per transition,
so QA can assert it rather than infer it. focus.docs.md states all eight, which
mechanism delivers each, and whether it is a repair or a deliberate handoff. It
also records how to measure one: focus is invisible to axe, and the Tab-once
check is non-discriminating where the nav precedes main in DOM order.
@github-actions

Copy link
Copy Markdown

📦 Preview published for commit de147ea

Install the preview with dist-tag:

npm install @vc-shell/framework@pr-370

Or pin to the exact commit:

npm install @vc-shell/framework@2.6.0-pr370.de147ea

Published packages (dist-tag pr-370, version 2.6.0-pr370.de147ea):

  • @vc-shell/framework
  • @vc-shell/api-client-generator
  • @vc-shell/create-vc-app
  • @vc-shell/config-generator
  • @vc-shell/migrate
  • @vc-shell/ts-config
  • @vc-shell/mf-config
  • @vc-shell/mf-host
  • @vc-shell/mf-module
  • @vc-shell/vc-app-skill

@maksimzinchuk
maksimzinchuk merged commit 9977ed6 into main Sep 23, 2026
12 checks passed
@maksimzinchuk
maksimzinchuk deleted the fix/VCST-5670-save-focus-target branch September 23, 2026 14:30
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