Repository navigation
Feature Volume Knob
The volume knob is specified to become a bidirectional control, but that work is
not built yet. Current-state truth now lives here under the hybrid rule in
Wiki-Conventions; the Spec Kit source is frozen at permalink d3cf582 and
distilled on Source-Spec-002.
Implemented today:
-
VolumeKnob.tsxrenders one invisible.volume-knob<button>over the painted volume knob and onevolume-led-barbelow it. - Volume is a 12-position step model,
0..11; emitted gain isstep / 11. - Clicking the current button only moves upward:
(step + 1) % 12. At step 11, the next click wraps to 0. - The button exposes
aria-label="Volume",aria-valuemin="0",aria-valuemax="11",aria-valuenow, and a special max text ending in "one louder". - The LED bar has 11 segments. Lit LEDs reflect the current step while enabled; all LEDs dim when disabled.
-
App.tsxholdsvolumein React state, defaults it to step 6 (6 / 11gain), calls the audio chain'ssetVolume(volume), and passes{ volume, onVolumeChange, disabled }toVolumeKnob. - The indicator maps volume proportionally across the calibrated arc from -235 degrees at step 0 (bottom-left) to 45 degrees at step 11 (down-right). Startup step 6 therefore places it at about 55% of the arc. TV power cycles preserve any volume adjustment made with the knob.
-
voiceStore.tsdoes not own volume. It tracks speaking, mouth, mic, and greeting flags only. - The unit test suite still asserts the old wrap behavior.
-
panel-alignment.spec.tsasserts.volume-knobgeometry against the painted TV frame at multiple viewport sizes.
Specified but not implemented:
- Split hit-area with independent up/down halves.
- Clamp-at-ends behavior with no wrap and no redundant change notification.
- Wheel interaction.
- Keyboard interaction.
- Rotating indicator animation and reduced-motion behavior.
- New helper, component, integration, and E2E tests.
The feature preserves the existing public component contract:
{ volume, onVolumeChange, disabled }
It also preserves the current volume meaning:
-
Volume step: integer 0 through 11 inclusive. -
Gain: normalized audio value,step / 11. -
Knob angle: presentation-only value derived from the step.
- Click or tap the right half of the knob to raise volume by one step.
- Click or tap the left half to lower volume by one step.
- The two halves tile the knob with no dead zone and no overlap; a click on the center line must go to one side.
- Both halves are inert while the TV is off and must appear unavailable.
- Both halves remain focusable and enabled at min/max; clamping happens in the handler so focus is not yanked away mid-interaction.
- The LED readout continues to reflect the current step in both directions.
- Raising at maximum leaves the value at 11.
- Lowering at zero leaves the value at 0.
- Attempts to move past either end do not emit
onVolumeChange. - The old wrap from 11 to 0, and any reverse wrap from 0 to 11, are removed.
- Wheel over the knob changes the volume.
-
deltaY < 0raises volume, matching the usual "scroll away = more" convention. -
deltaY > 0lowers volume. -
deltaY === 0does nothing. - Wheel input is inert while disabled.
- The spec notes that React wheel listeners are passive; if page scroll ever
becomes a real problem, the escape hatch is a native
{ passive: false }listener, not a speculative dependency.
- ArrowUp and ArrowRight raise the volume.
- ArrowDown and ArrowLeft lower the volume.
- Home goes to zero.
- End goes to maximum.
- Handled keys call
preventDefault()so the page does not also scroll. - Unrelated keys do nothing.
- Keyboard input is inert while disabled.
- The up and down controls expose distinct accessible names:
Volume upandVolume down. - The knob still exposes current value, minimum, maximum, and max-value text to assistive technology.
- The brass artwork does not rotate. A separate thin cyan pointer overlays the knob and rotates around its center.
- The frozen source spec described a roughly 270-degree arc from
-135degto135deg. Current visual calibration follows the requested positions:-235degat step 0 to45degat step 11. Step 2 is 18% of that 280-degree arc. - The indicator animates with a springy overshoot:
transform 320ms cubic-bezier(0.34, 1.56, 0.64, 1). - The indicator must use
pointer-events: noneso clicks reach the hit-area halves. - With
prefers-reduced-motion: reduce, the indicator still moves to the correct angle but with no animation. - The CSS custom property
--knob-anglecarries the angle; tests should read it withel.style.getPropertyValue('--knob-angle').
-
.volume-knobgeometry is test-locked. The E2E alignment suite asserts the hit-area center is withinPAINTED.volume.cy = 0.41with tolerance0.015and rechecks viewport sizes1536x1024,1280x720,1920x1080, and1024x900. Keep the.volume-knobclass,width: 55%,aspect-ratio: 1/1, and wrapper positioning stable. The new halves go inside this box with absolute positioning. Do not "fix" failures by editingpanel-alignment.spec.ts. - The brass knob is baked pixels in
packages/frontend/public/TV-frame.png, not a rendered DOM element. Do not modify the image and do not try to rotate or replace the brass artwork. This is the trap linked from Gotchas.
The frozen plan breaks the work into TDD cycles:
- Add
src/config/volume.tspure helpers and tests:VOLUME_MAX_STEP,VOLUME_LED_COUNT,KNOB_MIN_ANGLE_DEG,KNOB_MAX_ANGLE_DEG,clampStep,gainToStep,stepToGain,stepToAngle. - Rewrite
VolumeKnob.tsxso.volume-knobbecomes a container group with two real buttons,Volume downandVolume up, plus the unchanged LED bar. - Delete the old wrap-around test and replace it with clamp assertions.
- Add keyboard and wheel handling through the same
changeStep/clamp path. - Add
.volume-knob-indicatorand reduced-motion CSS. - Add App-level integration and Playwright E2E coverage, including the unchanged panel-alignment regression.
No new dependencies are required. App.tsx should not need a behavior change,
because the component prop contract stays stable.
| Issue | Status | Summary |
|---|---|---|
| #10 | Open | Parent scope: bidirectional knob, clamp at ends, wheel, keyboard, rotating indicator, tests, and hard geometry/artwork constraints. |
| #12 | Open | P1 bug fix: split left/right hit-area, clamp at zero/max, no redundant notifications, LED tracking, unchanged alignment. |
| #13 | Open | P2 affordances: mouse wheel and keyboard-only operation, with handled keys preventing page scroll. |
| #14 | Open | P3 polish: cyan rotating pointer, springy settle, reduced-motion behavior, and pointer-events safety. |
The four issues had no comments when verified on 2026-09-26.
- Drag-to-rotate.
- Touch swipe gestures beyond tapping the split halves.
- Persisting volume across reloads.
- A mute toggle.
- Changing the step count.
- Changing the gain curve.
- Retrofitting reduced-motion handling in unrelated components.
See also Component-Volume-Knob, Feature-Max-Height-Core, and Gotchas.
- Concept-Cloud-Only-Inference
- Concept-Budget-Ceiling
- Concept-Personality-Gate
- Concept-IP-And-Legal-Posture
- Concept-Supply-Chain-Discipline
- Concept-Graceful-Degradation
- Concept-Observability
- Concept-Testing-And-TDD
- Concept-Credential-Hygiene
Editing in the browser? Wiki edits are live and bypass wiki:lint. Read
Guide-Wiki-Contributing first.