Skip to content

Commit c8558a3

Browse files
committed
fix(site): tighten the tempo readouts seen on the live pages
On the deployed pages the BPM calculator left a wide gap before the unit: its input is sized in ch, but the digits carry negative letter-spacing, so centring split the slack on both sides. Right-align and drop the padding. Tap tempo's idle dash rendered as a grey bar above the baseline at display size. Ghost "000" digits keep the readout's shape and baseline, hidden from screen readers.
1 parent c987b77 commit c8558a3

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

‎docs/.vitepress/components/BpmToMs.vue‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ onMounted(() => {
110110
:min="MIN_BPM"
111111
:max="MAX_BPM"
112112
step="0.01"
113-
:style="{ width: `${Math.max(2, String(bpmInput).length) + 0.3}ch` }"
113+
:style="{ width: `${Math.max(2, String(bpmInput).length)}ch` }"
114114
aria-label="Tempo in beats per minute"
115115
@change="commitBpm"
116116
/>
@@ -252,7 +252,9 @@ onMounted(() => {
252252
padding: 0;
253253
border: 0;
254254
background: transparent;
255-
text-align: center;
255+
/* The negative letter-spacing makes the digits narrower than their ch
256+
width; right-aligning puts that slack away from the BPM unit. */
257+
text-align: right;
256258
font-family: inherit;
257259
line-height: 1;
258260
-moz-appearance: textfield;

‎docs/.vitepress/components/TapTempo.vue‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ onBeforeUnmount(() => {
103103
<span
104104
class="tt-number"
105105
:class="{ 'is-empty': bpm === null }"
106-
>{{ bpm ?? '—' }}</span>
106+
:aria-hidden="bpm === null"
107+
>{{ bpm ?? '000' }}</span>
107108
<span class="tt-unit">BPM</span>
108109
</div>
109110
<p class="tt-caption">

‎docs/.vitepress/theme/tools.css‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,12 @@
3131
color: var(--vp-c-brand-1);
3232
}
3333

34-
.tt-number.is-empty { color: var(--vp-c-text-3); }
34+
/* Ghost digits, like an unlit display: a dash at this size reads as a bar
35+
and sits off the baseline the unit aligns to. */
36+
.tt-number.is-empty {
37+
color: var(--vp-c-text-3);
38+
opacity: 0.3;
39+
}
3540

3641
.tt-unit {
3742
font-size: 1rem;

0 commit comments

Comments
 (0)