diff --git a/docs/releases/action-controls-2.3.20.json b/docs/releases/action-controls-2.3.20.json
new file mode 100644
index 0000000..a00218f
--- /dev/null
+++ b/docs/releases/action-controls-2.3.20.json
@@ -0,0 +1,17 @@
+{
+ "game": "powergrid",
+ "gameVersion": 13,
+ "publishedAt": "2026-11-01T20:28:11.887Z",
+ "viewer": {
+ "version": "2.3.20",
+ "url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-b941db4298f1f241f1f1/powergrid-viewer.umd.min.js",
+ "stylesheets": [
+ "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-b941db4298f1f241f1f1/powergrid-viewer.css"
+ ],
+ "scriptBytes": 1222070,
+ "sha256": "a780e6ed833a202ad26f3697b5e9ca7527d105a1bb439aa20315febc5d5aa7a5",
+ "bundle": "split-b941db4298f1f241f1f1",
+ "files": 42
+ },
+ "verified": true
+}
diff --git a/docs/viewer-publishing.md b/docs/viewer-publishing.md
index dce699d..e5e0010 100644
--- a/docs/viewer-publishing.md
+++ b/docs/viewer-publishing.md
@@ -22,4 +22,16 @@ Remove those two entries from the BGS game-version preferences, preserving all
other entries. Local undo now always removes one unconfirmed action, and board
sizing is always automatic; old saved values for these preferences are ignored.
The phase control pairs a phase pictogram with a skip, finish or edit pictogram.
-Only the action inset highlights on hover/focus; the whole control is clickable.
+From viewer 2.3.20, the paired pictograms use one shared grey surface with the
+same silver/white-border hover as the color-blind and simulation controls. The
+separator darkens on hover to preserve contrast. Passing has a normal black
+border unless it is the only legal option, when it gets a blue cue. Unaffordable
+plants are muted while choosing; the market outline is hidden when there are no
+legal plant choices. The resource action shows skip until a purchase is made,
+then finish; undoing all purchases restores skip. Phase actions and Undo share
+2-unit borders while enabled and 1-unit borders while disabled. Local tentative
+previews preserve public deck counters so buying resources does not flash an empty
+draw pile. Existing pass-confirmation dialogs are unchanged.
+
+After packaging, run `node viewer/scripts/action-controls-smoke.mjs` to check
+normal/only-pass states and hover/focus styling against the board-option buttons.
diff --git a/viewer/package.json b/viewer/package.json
index 4f0d64b..6ab6d8b 100644
--- a/viewer/package.json
+++ b/viewer/package.json
@@ -1,6 +1,6 @@
{
"name": "powergrid-viewer",
- "version": "2.3.19",
+ "version": "2.3.20",
"repository": {
"type": "git",
"url": "git+https://github.com/boardgamers/powergrid.git",
diff --git a/viewer/scripts/action-controls-smoke.mjs b/viewer/scripts/action-controls-smoke.mjs
new file mode 100644
index 0000000..eac7754
--- /dev/null
+++ b/viewer/scripts/action-controls-smoke.mjs
@@ -0,0 +1,121 @@
+// Run after packaging: node viewer/scripts/action-controls-smoke.mjs
+import assert from 'node:assert/strict';
+import { chromium } from 'playwright';
+import { auctionPreviewServer } from './auction-preview.mjs';
+
+const server = auctionPreviewServer();
+await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve));
+const browser = await chromium.launch({ executablePath: process.env.CHROMIUM_EXECUTABLE });
+try {
+ for (const mode of ['your-turn', 'only-pass']) {
+ const page = await browser.newPage();
+ await page.goto(`http://127.0.0.1:${server.address().port}/?mode=${mode}`);
+ const button = page.locator('[data-board-control="pass"]');
+ await button.waitFor();
+ const appearance = () =>
+ button.evaluate((element) => {
+ const style = (selector) => {
+ const css = getComputedStyle(element.querySelector(selector));
+ return { fill: css.fill, stroke: css.stroke, width: css.strokeWidth };
+ };
+ return {
+ phase: style('.phase-background'),
+ divider: style('.button-divider'),
+ phaseIcon: style('[data-phase-icon]'),
+ actionIcon: style('[data-action-icon]'),
+ outline: style('.button-outline'),
+ };
+ });
+ const reference = page.locator('[data-board-control="color-blind"]');
+ const referenceStyle = () =>
+ reference.locator('.option-background').evaluate((e) => {
+ const css = getComputedStyle(e);
+ return { fill: css.fill, stroke: css.stroke, width: css.strokeWidth };
+ });
+ const referenceRest = await referenceStyle();
+ await reference.hover();
+ const referenceHover = await referenceStyle();
+ await page.mouse.move(0, 0);
+ const before = await appearance();
+ assert.equal(before.phase.fill, referenceRest.fill);
+ assert.equal(before.outline.stroke, mode === 'only-pass' ? 'rgb(0, 0, 255)' : 'rgb(0, 0, 0)');
+ assert.equal(await page.locator('[data-market-highlight]').count(), mode === 'only-pass' ? 0 : 1);
+ const checkHover = async (focused = false) => {
+ const after = await appearance();
+ assert.equal(after.outline.stroke, 'rgb(255, 255, 255)');
+ assert.equal(after.outline.fill, 'none');
+ assert.equal(after.phase.fill, focused ? referenceRest.fill : referenceHover.fill);
+ assert.equal(after.outline.width, focused ? '3px' : referenceHover.width);
+ assert.equal(after.divider.stroke, focused ? before.divider.stroke : 'rgb(89, 102, 108)');
+ for (const key of ['phaseIcon', 'actionIcon']) {
+ assert.deepEqual(after[key], before[key], `${key} stays unchanged`);
+ }
+ };
+ for (const side of ['[data-phase-icon]', '[data-action-icon]']) {
+ await button.locator(side).hover();
+ await checkHover();
+ }
+ await page.mouse.move(0, 0);
+ assert.deepEqual(await appearance(), before);
+ await button.focus();
+ await checkHover(true);
+ if (mode === 'your-turn') {
+ const plant = page.locator('[data-market-plant="8"]');
+ await plant.hover();
+ assert.equal(
+ await plant
+ .locator(':scope > rect')
+ .first()
+ .evaluate((e) => getComputedStyle(e).stroke),
+ 'rgb(255, 255, 255)'
+ );
+ }
+ await page.close();
+ console.log(`${mode}: hover matches board options; focus and market cues passed`);
+ }
+ const page = await browser.newPage();
+ await page.goto(`http://127.0.0.1:${server.address().port}/?mode=resources`);
+ const phaseButton = page.locator('[data-board-control="pass"]');
+ await phaseButton.waitFor();
+ assert(await phaseButton.evaluate((e) => e.classList.contains('skip-action')));
+ await page.evaluate(() => {
+ const deck = document.querySelector('[data-board-slot="powerPlantDeck"]');
+ window.deckSnapshots = [deck.innerHTML];
+ window.deckObserver = new MutationObserver(() => window.deckSnapshots.push(deck.innerHTML));
+ window.deckObserver.observe(deck, { childList: true, attributes: true, characterData: true, subtree: true });
+ });
+ const echo = page.waitForResponse((response) => response.url().includes('/move?'));
+ await page.evaluate(() => {
+ const game = document.querySelector('.game').__vue__;
+ game.buyResource(game.G.players[0].availableMoves.BuyResource[0]);
+ });
+ await echo;
+ await page.waitForFunction(
+ () => !document.querySelector('[data-board-control="pass"]').classList.contains('skip-action')
+ );
+ const undo = page.locator('[data-board-control="undo"]');
+ const width = (locator) => locator.evaluate((e) => getComputedStyle(e).strokeWidth);
+ assert.equal(await width(phaseButton.locator('.button-outline')), '2px');
+ assert.equal(await width(undo.locator('.undo-background')), '2px');
+ await undo.click();
+ await page.waitForFunction(() =>
+ document.querySelector('[data-board-control="pass"]').classList.contains('skip-action')
+ );
+ assert.equal(await width(phaseButton.locator('.button-outline')), '2px');
+ assert.equal(await width(undo.locator('.undo-background')), '1px', 'disabled undo is thinner');
+ const snapshots = await page.evaluate(() => {
+ window.deckObserver.disconnect();
+ return window.deckSnapshots;
+ });
+ assert(
+ snapshots.every((snapshot) => snapshot === snapshots[0]),
+ 'draw pile stays unchanged during buy/echo/undo'
+ );
+ await page.close();
+ console.log(
+ 'Resources: skip → finish → undo → skip; matching enabled borders, thin disabled border, stable draw pile'
+ );
+} finally {
+ await browser.close();
+ await new Promise((resolve) => server.close(resolve));
+}
diff --git a/viewer/scripts/auction-preview.mjs b/viewer/scripts/auction-preview.mjs
index 70c237b..c976fba 100644
--- a/viewer/scripts/auction-preview.mjs
+++ b/viewer/scripts/auction-preview.mjs
@@ -16,15 +16,18 @@ function position(mode) {
'auction-preview'
);
G.round = 2;
- G.playerOrder = [2, 0, 1];
- G.currentPlayers = [2];
+ const yourTurn = mode === 'your-turn' || mode === 'only-pass' || mode === 'resources';
+ if (mode === 'resources') G.phase = engine.Phase.Resources;
+ G.playerOrder = yourTurn ? [0, 1, 2] : [2, 0, 1];
+ G.currentPlayers = [yourTurn ? 0 : 2];
const plant = (n) => copy(powerPlants.find((p) => p.number === n));
G.actualMarket = (fastBid ? [17, 19, 20, 21] : [8, 10, 13, 15]).map(plant);
G.futureMarket = [22, 23, 24, 25].map(plant);
G.players.forEach((p, i) => {
p.name = ['You', 'Leo', 'Ada'][i];
- p.money = [10, 40, 50][i];
+ p.money = [mode === 'only-pass' ? 1 : 10, 40, 50][i];
p.powerPlants = [plant([3, 4, 5][i])];
+ if (mode === 'resources' && i === 0) p.oilCapacity = 4;
p.availableMoves = null;
});
const visible = new Set(
@@ -32,16 +35,21 @@ function position(mode) {
);
G.powerPlantsDeck = G.powerPlantsDeck.filter((p) => !visible.has(p.number));
G.cardsLeft = G.powerPlantsDeck.length;
- G.players[2].availableMoves = engine.availableMoves(G, G.players[2]);
- G.log.push({ type: 'event', event: 'Waiting for Ada to start an auction.' });
+ const activePlayer = G.players[G.currentPlayers[0]];
+ activePlayer.availableMoves = engine.availableMoves(G, activePlayer);
+ G.log.push({
+ type: 'event',
+ event: yourTurn ? 'Your turn to start an auction.' : 'Waiting for Ada to start an auction.',
+ });
G.newTurn = true;
return G;
}
const states = new Map();
-const html = `
Power Grid · Auction auto-pass previewLocal previewMobile previewYou have 10. With hidden money, try the auto-pass checkbox in your player card before Ada bids.
+
+
diff --git a/viewer/src/components/buttons/BoardOption.vue b/viewer/src/components/buttons/BoardOption.vue
index f4f8e76..c1e68cb 100644
--- a/viewer/src/components/buttons/BoardOption.vue
+++ b/viewer/src/components/buttons/BoardOption.vue
@@ -11,7 +11,7 @@
@keydown.enter.prevent="$emit('click')"
@keydown.space.prevent="$emit('click')"
>
-
+
@@ -64,14 +64,8 @@ export default class BoardOption extends Vue {
.active {
color: white;
}
-.board-option:hover .option-background {
- stroke-width: 2;
-}
+
.board-option:focus {
outline: none;
}
-.board-option:focus-visible .option-background {
- stroke: #fff;
- stroke-width: 3;
-}
diff --git a/viewer/src/components/buttons/PassButton.vue b/viewer/src/components/buttons/PassButton.vue
index 26da8de..b969bd0 100644
--- a/viewer/src/components/buttons/PassButton.vue
+++ b/viewer/src/components/buttons/PassButton.vue
@@ -1,6 +1,6 @@
-
-
-
+
+
+
+
{{ text }}
@@ -51,7 +60,7 @@ export default class PassButton extends Vue {
get actionPath(): string {
const paths: Record = {
- skip: 'M16 8A7 7 0 1 1 2 8A7 7 0 1 1 16 8Z M4 3L14 13',
+ skip: 'M16 8A8 8 0 1 1 0 8A8 8 0 1 1 16 8Z M2.34 2.34L13.66 13.66',
finish: 'M1 9L6 14L16 2',
edit: 'M2 11L12 1L16 5L6 15L1 16Z M10 3L14 7',
};
@@ -73,17 +82,19 @@ export default class PassButton extends Vue {
diff --git a/viewer/src/components/buttons/UndoButton.vue b/viewer/src/components/buttons/UndoButton.vue
index 7199fbe..8b76021 100644
--- a/viewer/src/components/buttons/UndoButton.vue
+++ b/viewer/src/components/buttons/UndoButton.vue
@@ -10,7 +10,14 @@
@keydown.enter.prevent="enabled && $emit('click')"
@keydown.space.prevent="enabled && $emit('click')"
>
-
+
rect:first-of-type {
+ stroke: white;
+}
diff --git a/viewer/src/util/turn-buffer.ts b/viewer/src/util/turn-buffer.ts
index 881034b..f037010 100644
--- a/viewer/src/util/turn-buffer.ts
+++ b/viewer/src/util/turn-buffer.ts
@@ -182,6 +182,13 @@ export function replayTurnBuffer(
for (const move of turnMoves) {
try {
state = engineMove(state, move, player);
+ // The viewer receives an empty secret deck, not an exhausted deck.
+ // Tentative moves cannot draw cards; retain the public counters rather
+ // than flashing an empty pile until the server's echo restores them.
+ if (committedState.seed === 'secret' && state.newTurn === false) {
+ state.cardsLeft = committedState.cardsLeft;
+ state.nextCardWeak = committedState.nextCardWeak;
+ }
} catch (err) {
console.error('dropping turn-buffer tail no longer legal on the committed state', move, err);
failure = err;
diff --git a/viewer/tests/unit/choice-revision-ui.spec.ts b/viewer/tests/unit/choice-revision-ui.spec.ts
index fceaae4..2025219 100644
--- a/viewer/tests/unit/choice-revision-ui.spec.ts
+++ b/viewer/tests/unit/choice-revision-ui.spec.ts
@@ -66,7 +66,7 @@ describe('phase button', () => {
it('pairs distinct phase icons with skip or finish and complete accessible labels', () => {
const paths: string[] = [];
for (const phase of [Phase.Auction, Phase.Resources, Phase.Building, Phase.Bureaucracy]) {
- const context = { G: { phase } };
+ const context = { G: { phase }, playerBoughtResourceThisTurn: () => true };
const text = computed('phaseButtonText', context);
const icon = computed('phaseButtonIcon', context);
const action = computed('phaseButtonAction', context);
@@ -82,6 +82,77 @@ describe('phase button', () => {
expect(new Set(paths).size).to.equal(4);
});
+ it('highlights skip only when neither bidding nor choosing a plant is legal', () => {
+ const context = (availableMoves: any) => ({
+ canUsePhaseButton: true,
+ phaseButtonAction: 'skip',
+ player: 0,
+ G: { players: [{ availableMoves }] },
+ });
+ expect(computed('highlightPhaseButton', context({ Pass: true }))).to.equal(true);
+ expect(computed('highlightPhaseButton', context({ Pass: true, Bid: [11] }))).to.equal(false);
+ expect(computed('highlightPhaseButton', context({ Pass: true, ChoosePowerPlant: [8] }))).to.equal(false);
+ expect(computed('highlightPhaseButton', { ...context({}), canUsePhaseButton: false })).to.equal(false);
+ expect(computed('highlightPhaseButton', { ...context({}), changingBid: true, revisionBids: [8] })).to.equal(
+ false
+ );
+ expect(computed('highlightPhaseButton', { ...context({}), changingBid: true, revisionBids: [] })).to.equal(
+ true
+ );
+ });
+
+ it('shows skip until a resource is bought and restores skip after all buys are undone', () => {
+ const context: any = { player: 0, G: { phase: Phase.Resources, log: [] } };
+ context.playerBoughtResourceThisTurn = () => options.methods.playerBoughtResourceThisTurn.call(context);
+ expect(computed('phaseButtonAction', context)).to.equal('skip');
+ context.G.log.push({ type: 'move', player: 0, move: { name: 'BuyResource' } });
+ expect(computed('phaseButtonAction', context)).to.equal('finish');
+ context.G.log.pop();
+ expect(computed('phaseButtonAction', context)).to.equal('skip');
+ context.G.log.push({ type: 'move', player: 1, move: { name: 'BuyResource' } });
+ expect(computed('phaseButtonAction', context)).to.equal('skip');
+ });
+
+ it('highlights resource skip only when buying is unavailable', () => {
+ const context: any = {
+ canUsePhaseButton: true,
+ phaseButtonAction: 'skip',
+ player: 0,
+ G: {
+ phase: Phase.Resources,
+ players: [{ availableMoves: { Pass: true, BuyResource: [{ resource: 'coal' }] } }],
+ },
+ };
+ expect(computed('highlightPhaseButton', context)).to.equal(false);
+ context.G.players[0].availableMoves.BuyResource = [];
+ expect(computed('highlightPhaseButton', context)).to.equal(true);
+ });
+
+ it('keeps skip styling while accepting the only-option highlight', async () => {
+ const wrapper = mount(PassButton, {
+ propsData: { text: 'Pass bid', action: 'skip', enabled: true, highlightButton: false },
+ });
+ expect(wrapper.classes()).to.include('skip-action');
+ expect(wrapper.classes()).not.to.include('highlightButton');
+ await wrapper.setProps({ highlightButton: true });
+ expect(wrapper.classes()).to.include('highlightButton');
+ wrapper.destroy();
+ });
+
+ it('uses equal-scale icons and paints one shared outline above both backgrounds', () => {
+ const wrapper = mount(PassButton, { propsData: { text: 'Pass bid', icon: 'auction', action: 'skip' } });
+ expect(wrapper.find('[data-phase-icon]').attributes('transform')).to.equal('translate(12, 5)');
+ expect(wrapper.find('[data-action-icon]').attributes('transform')).to.equal('translate(52, 5)');
+ const children = Array.from(wrapper.element.children);
+ const outline = wrapper.find('.button-outline');
+ expect(children.indexOf(outline.element)).to.be.greaterThan(
+ children.indexOf(wrapper.find('[data-action-icon]').element)
+ );
+ expect(outline.attributes('fill')).to.equal('none');
+ expect(outline.attributes('pointer-events')).to.equal('none');
+ wrapper.destroy();
+ });
+
it('keeps the phase visible when editing and uses skip when passing a revised bid', () => {
for (const context of [
{ G: { phase: Phase.Auction }, revisableBid: 'bid' },
diff --git a/viewer/tests/unit/market-choice-highlights.spec.ts b/viewer/tests/unit/market-choice-highlights.spec.ts
new file mode 100644
index 0000000..d4dc72c
--- /dev/null
+++ b/viewer/tests/unit/market-choice-highlights.spec.ts
@@ -0,0 +1,33 @@
+import PowerPlantMarket from '@/components/boards/PowerPlantMarket.vue';
+import { shallowMount } from '@vue/test-utils';
+import { expect } from 'chai';
+
+describe('market choice highlights', () => {
+ it('groups the market while muting unavailable choices and follows eligibility changes', async () => {
+ const wrapper = shallowMount(PowerPlantMarket, {
+ propsData: { canChoose: true, chooseablePowerPlants: [8, 10] },
+ provide: { preferences: {} },
+ });
+ await wrapper.setData({
+ actualMarketCards: [
+ { id: 'a', x: 165, y: 24, powerPlant: { number: 8 } },
+ { id: 'b', x: 230, y: 24, powerPlant: { number: 13 } },
+ { id: 'c', x: 165, y: 80, powerPlant: { number: 10 } },
+ ],
+ });
+ const unavailable = () =>
+ wrapper.findAll('.unavailable-plant').wrappers.map((w) => w.attributes('data-market-plant'));
+ expect(unavailable()).to.deep.equal(['13']);
+ expect(wrapper.find('[data-market-highlight]').attributes('height')).to.equal('121');
+ expect(wrapper.find('[data-market-highlight]').attributes('pointer-events')).to.equal('none');
+ await wrapper.setProps({ chooseablePowerPlants: [13] });
+ expect(unavailable()).to.deep.equal(['8', '10']);
+ await wrapper.setProps({ canChoose: false });
+ expect(unavailable()).to.deep.equal([]);
+ expect(wrapper.find('[data-market-highlight]').exists()).to.equal(false);
+ await wrapper.setProps({ canChoose: true, chooseablePowerPlants: [] });
+ expect(unavailable()).to.deep.equal(['8', '13', '10']);
+ expect(wrapper.find('[data-market-highlight]').exists()).to.equal(false);
+ wrapper.destroy();
+ });
+});
diff --git a/viewer/tests/unit/turn-buffer.spec.ts b/viewer/tests/unit/turn-buffer.spec.ts
index 45187a8..6a0e0c0 100644
--- a/viewer/tests/unit/turn-buffer.spec.ts
+++ b/viewer/tests/unit/turn-buffer.spec.ts
@@ -245,6 +245,33 @@ describe('turn-buffer', () => {
expect(state.players[player].availableMoves![MoveName.ChoosePowerPlant]).to.be.undefined;
});
+ it('preserves public deck counters while previewing purchases on a secret deck', () => {
+ let G: GameState = setup(4, { variant: 'recharged' }, 'turn-buffer-resources');
+ for (let i = 0; i < 4000; i++) {
+ const seat = G.players.findIndex((p) => p.availableMoves);
+ if (seat < 0) break;
+ const buys = G.players[seat].availableMoves![MoveName.BuyResource];
+ if (G.phase === Phase.Resources && buys && buys.length) {
+ const stripped = stripSecret(clone(G), seat);
+ expect(stripped.powerPlantsDeck).to.deep.equal([]);
+ expect(stripped.cardsLeft).to.be.greaterThan(0);
+ const buy: Move = { name: MoveName.BuyResource, data: buys[0], time: 1000 };
+ const preview = replayTurnBuffer(stripped, [buy], seat);
+ expect(preview.failure).to.equal(undefined);
+ expect(preview.state.newTurn).to.equal(false);
+ expect(preview.state.cardsLeft).to.equal(stripped.cardsLeft);
+ expect(preview.state.nextCardWeak).to.equal(stripped.nextCardWeak);
+ const server = stripSecret(engineMove(clone(G), buy, seat), seat);
+ expect(preview.state.cardsLeft).to.equal(server.cardsLeft);
+ expect(preview.state.nextCardWeak).to.equal(server.nextCardWeak);
+ expect(replayTurnBuffer(stripped, [], seat).state.cardsLeft).to.equal(stripped.cardsLeft);
+ return;
+ }
+ G = moveAI(G, seat);
+ }
+ expect.fail('never reached a resource purchase');
+ });
+
it('a preview after every buy stops a resource click going past storage capacity', () => {
// Drive a real game to a seat that can buy resources.
let G: GameState = setup(4, {}, 'turn-buffer-resources');