[PR #7850] [MERGED] fix(avatars): preserve repeated keyboard placement #7965

Closed
opened 2026-10-24 04:09:14 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7850
Author: @SpicyMarinara
Created: 10/19/2026
Status: ✅ Merged
Merged: 10/19/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/avatar-keyboard-placement


📝 Commits (1)

  • 3efd0cf fix(avatars): preserve repeated keyboard placement

📊 Changes

3 files changed (+32 additions, -6 deletions)

View changed files

📝 e2e/avatar-placement.e2e.ts (+10 -1)
📝 packages/client/src/components/chat/use-sprite-placement-drag.ts (+18 -3)
📝 packages/client/src/features/avatars/stage/AvatarStage.tsx (+4 -2)

📄 Description

Linked issue

Closes #7849.

Why this change

Holding an arrow key while arranging an avatar can lose movement. In a mounted Roleplay chat, 20 native right-arrow keydowns moved the avatar only 13 percentage points; selecting Done then retained that incorrect position. This follows the outside-diff finding in the avatar review.

What changed

  • Reuse the placement hook's existing latest-position ref for keyboard nudges and Done. Each nudge updates that ref and local state before notifying the chat.
  • Synchronize external placements in a layout effect so a pending passive update cannot rewind the next key press.
  • Extend the existing uploaded-VRM browser case with 20 native held-key repeats, immediate Done, an exact movement assertion and reload persistence. It performs no DOM reads between keydowns.

Validation

Draft head: 3efd0cf3bc4323e242ebbce62ef593bdd263e3f5, based on staging 9ab7f0052e48af000c844c8b63ba8ef6d708f160. Validation on this staging base is being rerun before readiness.

Prior-base evidence on a49944e0 and its working fix:

  • The exact final browser case failed against unchanged production code: expected x48.125, received x41.125 after 20 native right-arrow keydowns and Done. Three earlier bounded repeats also lost moves.

  • The corrected case passed all six Roleplay/Game cases across desktop Chromium, phone Chromium and phone WebKit.

  • node scripts/run-regressions.mjs --filter avatar-placement: 1/1 passed.

  • pnpm check: passed, including localization, formatting, lint, types and production builds.

  • pnpm smoke:ui: 7/7 passed.

  • All three patch files are byte-identical after cherry-picking onto the current staging base. Current-head checks, container proof and substantive local/hosted review remain pending.

  • pnpm check passes locally

  • Container (Docker / Podman) built and ran without issue

  • Ran the app, clicked through the changes manually

  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)

  • Above manual verification completed (describe below)

  • Read and followed CONTRIBUTING.md

Manual verification notes

Manually hold arrow keys while arranging an uploaded avatar, select Done immediately, and reload to check the saved position. Check external position changes and pointer dragging as well. The automated browser proof uses native Playwright keyboard input in a mounted app with a fixture VRM; it does not verify physical devices or native shells. Chromium phone dragging uses CDP touch input; WebKit retains the documented synthetic held-touch fallback.

Docs and release impact

The existing avatar guide already describes arrow-key movement and Done. This repair restores that documented behavior and changes no UI copy, dependencies or storage format.

  • No docs changes needed
  • Updated docs as needed
  • Translated documentation updated or follow-up tracked
  • Version/release files updated (only if this PR includes a version bump)

UI evidence

The controls retain their appearance from the published fixture screenshots. The new regression checks the exact position after native repeated key input and after reload; no character asset or paid provider call is involved.

Summary by CodeRabbit

  • Bug Fixes
    • Improved avatar placement with keyboard controls: each right-arrow press moves the avatar, and the updated position is retained after confirming placement.
    • Confirming placement now disables further pointer interaction with the avatar.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/7850 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 10/19/2026 **Status:** ✅ Merged **Merged:** 10/19/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/avatar-keyboard-placement` --- ### 📝 Commits (1) - [`3efd0cf`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3efd0cf3bc4323e242ebbce62ef593bdd263e3f5) fix(avatars): preserve repeated keyboard placement ### 📊 Changes **3 files changed** (+32 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `e2e/avatar-placement.e2e.ts` (+10 -1) 📝 `packages/client/src/components/chat/use-sprite-placement-drag.ts` (+18 -3) 📝 `packages/client/src/features/avatars/stage/AvatarStage.tsx` (+4 -2) </details> ### 📄 Description ## Linked issue Closes #7849. ## Why this change Holding an arrow key while arranging an avatar can lose movement. In a mounted Roleplay chat, 20 native right-arrow keydowns moved the avatar only 13 percentage points; selecting Done then retained that incorrect position. This follows the outside-diff finding in [the avatar review](https://github.com/Pasta-Devs/Marinara-Engine/pull/7843#pullrequestreview-5576222655). ## What changed - Reuse the placement hook's existing latest-position ref for keyboard nudges and Done. Each nudge updates that ref and local state before notifying the chat. - Synchronize external placements in a layout effect so a pending passive update cannot rewind the next key press. - Extend the existing uploaded-VRM browser case with 20 native held-key repeats, immediate Done, an exact movement assertion and reload persistence. It performs no DOM reads between keydowns. ## Validation Draft head: `3efd0cf3bc4323e242ebbce62ef593bdd263e3f5`, based on staging `9ab7f0052e48af000c844c8b63ba8ef6d708f160`. Validation on this staging base is being rerun before readiness. Prior-base evidence on `a49944e0` and its working fix: - The exact final browser case failed against unchanged production code: expected x48.125, received x41.125 after 20 native right-arrow keydowns and Done. Three earlier bounded repeats also lost moves. - The corrected case passed all six Roleplay/Game cases across desktop Chromium, phone Chromium and phone WebKit. - `node scripts/run-regressions.mjs --filter avatar-placement`: 1/1 passed. - `pnpm check`: passed, including localization, formatting, lint, types and production builds. - `pnpm smoke:ui`: 7/7 passed. - All three patch files are byte-identical after cherry-picking onto the current staging base. Current-head checks, container proof and substantive local/hosted review remain pending. - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes Manually hold arrow keys while arranging an uploaded avatar, select Done immediately, and reload to check the saved position. Check external position changes and pointer dragging as well. The automated browser proof uses native Playwright keyboard input in a mounted app with a fixture VRM; it does not verify physical devices or native shells. Chromium phone dragging uses CDP touch input; WebKit retains the documented synthetic held-touch fallback. ## Docs and release impact The existing avatar guide already describes arrow-key movement and Done. This repair restores that documented behavior and changes no UI copy, dependencies or storage format. - [ ] No docs changes needed - [ ] Updated docs as needed - [ ] Translated documentation updated or follow-up tracked - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence The controls retain their appearance from [the published fixture screenshots](https://github.com/Pasta-Devs/Marinara-Engine/pull/7843#issuecomment-6273538453). The new regression checks the exact position after native repeated key input and after reload; no character asset or paid provider call is involved. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved avatar placement with keyboard controls: each right-arrow press moves the avatar, and the updated position is retained after confirming placement. * Confirming placement now disables further pointer interaction with the avatar. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-24 04:09:14 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#7965
No description provided.