Clicking button of actors on sidebar not change map or notes #41

Closed
opened 2026-10-14 22:26:45 +00:00 by Syndria98 · 2 comments
Owner

Make that when clicking the actors button on the sidebar, if there is a map anchored, make that it does not disappear. And if there are notes displaying, that they do not disappear. More generally, make that when clicking the actors or items buttons on the sidebar, the contents of the note-container do not change

Make that when clicking the actors button on the sidebar, if there is a map anchored, make that it does not disappear. And if there are notes displaying, that they do not disappear. More generally, make that when clicking the actors or items buttons on the sidebar, the contents of the note-container do not change
Syndria98 added the ai-ready label 2026-10-14 22:26:45 +00:00
Agent added the working label 2026-10-14 22:26:47 +00:00
Collaborator

Done. Here's what I found and changed.

Cause

selectSection() in frontend/app/components/partials/ContentSidebar.vue:219 unconditionally wrote the content pane on every sidebar button click:

SetActivePane(section === 'maps' && AnchoredMap.value ? 'map' : 'notes');

So clicking actors or items always forced the pane to notes: an anchored map was swapped out of view (Content.vue hides .anchored-map when ActivePane !== 'map'), and the note container was brought forward, which looked like the map/notes "disappearing".

Fix

Only the buttons that actually speak about the note container change it — the notes button shows the open notes, the maps button shows the anchored map (the switching added in #15). The actor and item buttons just select their section and load their list; the note container keeps whatever it was showing:

if (section === 'notes') SetActivePane('notes');
else if (section === 'maps' && AnchoredMap.value) SetActivePane('map');

No change was needed in services/Content.js — the anchor itself was never dropped, only the visible pane.

Tests

New tests/sidebar-section-pane.test.js (8 tests) lifts selectSection out of the sidebar's <script setup> block into a node:vm context with SetActivePane / the entry fetch stubbed, in the same spirit as tests/map-viewer.test.js. It covers: the actors and items buttons keep an anchored map visible and still anchored, keep the open notes visible, still select their section and load their list, plus the #15 behaviour — notes ↔ maps switching and the maps button doing nothing without an anchored map.

Verified against the repo suite: node --test tests/ → 116 tests, 116 pass, 0 fail. I also confirmed the two anchored-map tests fail against the previous implementation, so the new tests do catch the reported bug.

Done. Here's what I found and changed. ## Cause `selectSection()` in `frontend/app/components/partials/ContentSidebar.vue:219` unconditionally wrote the content pane on every sidebar button click: ```js SetActivePane(section === 'maps' && AnchoredMap.value ? 'map' : 'notes'); ``` So clicking **actors** or **items** always forced the pane to `notes`: an anchored map was swapped out of view (`Content.vue` hides `.anchored-map` when `ActivePane !== 'map'`), and the note container was brought forward, which looked like the map/notes "disappearing". ## Fix Only the buttons that actually speak about the note container change it — the notes button shows the open notes, the maps button shows the anchored map (the switching added in #15). The actor and item buttons just select their section and load their list; the note container keeps whatever it was showing: ```js if (section === 'notes') SetActivePane('notes'); else if (section === 'maps' && AnchoredMap.value) SetActivePane('map'); ``` No change was needed in `services/Content.js` — the anchor itself was never dropped, only the visible pane. ## Tests New `tests/sidebar-section-pane.test.js` (8 tests) lifts `selectSection` out of the sidebar's `<script setup>` block into a `node:vm` context with `SetActivePane` / the entry fetch stubbed, in the same spirit as `tests/map-viewer.test.js`. It covers: the actors and items buttons keep an anchored map visible and still anchored, keep the open notes visible, still select their section and load their list, plus the #15 behaviour — notes ↔ maps switching and the maps button doing nothing without an anchored map. Verified against the repo suite: `node --test tests/` → 116 tests, 116 pass, 0 fail. I also confirmed the two anchored-map tests fail against the previous implementation, so the new tests do catch the reported bug.
Collaborator

Implementation is ready for review: #43

Implementation is ready for review: https://git.aranroig.com/Syndria98/dragonroll/pulls/43
Agent added help wanted and removed working labels 2026-10-14 22:30:17 +00:00
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Syndria98/dragonroll#41