fix(dungeon): make Ctrl reach Int. Walls, not just Rooms/Doors - #136
Open
DimitroffVodka wants to merge 1 commit into
Open
fix(dungeon): make Ctrl reach Int. Walls, not just Rooms/Doors#136DimitroffVodka wants to merge 1 commit into
DimitroffVodka wants to merge 1 commit into
Conversation
The Dungeons tab footer advertises "Ctrl to switch mode" in all three modes, but the handler in TraySD only toggled tiles <-> doors, so the Int. Walls tab was unreachable from the keyboard and Ctrl from within it dropped back to Rooms. Cycle all three in tab order instead, off a single DUNGEON_MODES list that setDungeonMode now validates against, so the tab order and the cycle order cannot drift apart unnoticed. Also guard on event.repeat: Chromium auto-repeats modifier keydown, so a held Ctrl would spin the cycle and re-render the tray on every tick. The test asserts the cycle order equals the data-dungeon-mode order parsed out of tray.hbs, so reordering the tabs alone fails it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The Dungeons tab footer renders
Ctrl to switch modein all three modes, but the handler inscripts/tray/TraySD.mjsonly toggledtiles <-> doors. Int. Walls was unreachable from the keyboard, and pressing Ctrl while in it dropped back to Rooms.This started as "delete the dead hint row" — but the handler is not dead. A
grep ctrlKeymisses it because it keys onevent.key === "Control". The hint was 2/3 true, so the fix is on the handler, not the template.tray.hbsis untouched.How
nextDungeonMode()cycles all three in tab order, off a singleDUNGEON_MODESlist thatsetDungeonModenow validates against — so tab order and cycle order can't drift apart unnoticed.event.repeatguard. Chromium auto-repeats modifier keydown, so a held Ctrl would spin the cycle andrenderTray()on every tick. This was latent in the old toggle too.nextDungeonModelives indungeon-tool-state.mjs, the leaf module that already owns the mode vocabulary and imports nothing, so the test needs no Foundry harness.Test plan
dev/tests/dungeon-mode-cycle.test.mjs— asserts the cycle visits every mode and wraps, that an unknown mode restarts it rather than wedging, and that every cycled value is onesetDungeonModeaccepts. The load-bearing one parsesdata-dungeon-modeout oftray.hbsand asserts that order equalsDUNGEON_MODES, so reordering the tabs alone fails the suite.npm test— 1501 pass, 0 failnpm run verify—verify: OK, 0 errors, BLOCKING section emptyNot covered by Node tests: that Ctrl actually fires in a live world. The listener is a document-level keydown registered inside
initTray(), gated on the tray being expanded and in dungeons view — that needs live-V14 acceptance.Known gap, not fixed here
Ctrl is also the prefix of Ctrl+Z / Ctrl+S, so those still cycle the mode as a side effect while the Dungeons tab is open. Pre-existing in the old toggle, not introduced here. A real fix needs keyup-without-combo detection rather than a one-liner.
🤖 Generated with Claude Code