|
| 1 | +# Input Mapping V2 Token Display and Capture Gating Report |
| 2 | + |
| 3 | +Task: PR_26140_108-polish-input-mapping-v2-token-display-and-capture-gating |
| 4 | + |
| 5 | +## Scope |
| 6 | +- Read docs/dev/PROJECT_INSTRUCTIONS.md before making changes. |
| 7 | +- Treated the explicit PR_26140_108 request as the active BUILD scope; docs/pr/BUILD_PR.md currently describes an unrelated Level 18 rebase workflow. |
| 8 | +- Did not change schemas. |
| 9 | +- Did not touch sample JSON. |
| 10 | +- Did not run the full samples smoke test because this PR is limited to Input Mapping V2 tool UI/runtime behavior and is covered by targeted syntax checks plus Workspace V2 Playwright. |
| 11 | + |
| 12 | +## Implementation |
| 13 | +- Updated Captured Mappings token rendering so each mapping is a single bracketed token/span with comma-separated parts inside the token, for example `[Keyboard, KeyH, Hold]`, `[Mouse, Left Button, Click]`, and `[Game Controller, Axis 0+, Button]`. |
| 14 | +- Removed separate comma separator elements outside mapping tokens. |
| 15 | +- Preserved hover/title metadata by leaving token title generation tied to the existing detailed input metadata. |
| 16 | +- Added capture gating based on the selected gesture source: |
| 17 | + - Keyboard gestures enable only Capture Keyboard. |
| 18 | + - Mouse gestures enable only Capture Mouse. |
| 19 | + - Game Controller gestures enable only detected game controller capture buttons. |
| 20 | + - Combo gestures keep multi-device capture available. |
| 21 | +- Preserved selected tile indication, used-input highlighting, active capture highlight/cancel, and combo capture behavior. |
| 22 | +- Normalized visible game controller axis detail from `Axis 0 +` to `Axis 0+` for compact token display. |
| 23 | + |
| 24 | +## Playwright Impact |
| 25 | +Playwright impacted: Yes. |
| 26 | + |
| 27 | +Validated behavior: |
| 28 | +- Bracketed mapping tokens render commas inside each token/span and no outside separator spans are created. |
| 29 | +- Keyboard Hold renders `[Keyboard, KeyH, Hold]`. |
| 30 | +- Mouse Click renders `[Mouse, Left Button, Click]`. |
| 31 | +- Mocked game controller axis capture renders `[Game Controller, Axis 0+, Button]`. |
| 32 | +- Selecting Mouse > Click disables Keyboard and Game Controller capture buttons while leaving Mouse enabled. |
| 33 | +- Selecting Keyboard > Press/Hold enables Keyboard capture only. |
| 34 | +- Selecting Game Controller > Button enables game controller capture buttons only. |
| 35 | +- Existing Input Mapping V2 flows still pass, including combo capture, used-input highlight, selected tile behavior, JSON/Copy JSON, haptics, and shortcut/context behavior. |
| 36 | + |
| 37 | +Expected pass behavior: |
| 38 | +- All targeted syntax checks pass. |
| 39 | +- Input Mapping V2 focused Playwright slice passes. |
| 40 | +- `npm run test:workspace-v2` passes. |
| 41 | + |
| 42 | +Expected fail behavior: |
| 43 | +- Tests fail if separator comma spans reappear outside tokens, if bracketed token text regresses, or if non-selected capture devices remain enabled after selecting a device-specific gesture. |
| 44 | + |
| 45 | +## Validation |
| 46 | +- PASS: `node --check tools/input-mapping-v2/js/ToolStarterApp.js` |
| 47 | +- PASS: `node --check tools/input-mapping-v2/js/controls/CaptureControl.js` |
| 48 | +- PASS: `node --check tools/input-mapping-v2/js/controls/PreviewPanelControl.js` |
| 49 | +- PASS: `node --check tools/input-mapping-v2/js/services/EngineInputSourceService.js` |
| 50 | +- PASS: `node --check tests/playwright/tools/WorkspaceManagerV2.spec.mjs` |
| 51 | +- PASS: `npx playwright test tests/playwright/tools/WorkspaceManagerV2.spec.mjs -g "Input Mapping V2"` (6 passed) |
| 52 | +- PASS: `npm run test:workspace-v2` (65 passed) |
| 53 | +- PASS: `git diff --check` (line-ending warnings only) |
| 54 | +- Generated: `docs/dev/reports/playwright_v8_coverage_report.txt` |
| 55 | +- Generated: `docs/dev/reports/coverage_changed_js_guardrail.txt` |
| 56 | + |
| 57 | +## Manual Validation |
| 58 | +1. Open `tools/input-mapping-v2/index.html`. |
| 59 | +2. Select `Keyboard > Hold`, capture `H`, and confirm the tile shows `[Keyboard, KeyH, Hold]` as one token. |
| 60 | +3. Select `Mouse > Click`, confirm Capture Keyboard and game controller buttons are disabled/grayed out, then capture left click and confirm `[Mouse, Left Button, Click]`. |
| 61 | +4. With a browser-exposed game controller, select `Game Controller > Button`, confirm Keyboard/Mouse capture are disabled and the controller capture button is enabled. |
| 62 | +5. Hover captured tokens and confirm detailed metadata remains available. |
| 63 | + |
| 64 | +## Files Changed |
| 65 | +- `tools/input-mapping-v2/js/ToolStarterApp.js` |
| 66 | +- `tools/input-mapping-v2/js/controls/CaptureControl.js` |
| 67 | +- `tools/input-mapping-v2/js/controls/PreviewPanelControl.js` |
| 68 | +- `tools/input-mapping-v2/js/services/EngineInputSourceService.js` |
| 69 | +- `tools/input-mapping-v2/styles/inputMappingV2.css` |
| 70 | +- `tests/playwright/tools/WorkspaceManagerV2.spec.mjs` |
0 commit comments