Skip to content

Speakr is a personal, self-hosted web application designed for transcribing audio recordings

Python

Mobile volume slider: replace writing-mode-vertical implementation with a rotation-based one so the thumb is pixel-aligned with the track — the previous .volume-slider-vertical used writing-mode: vertical-lr + direction: rtl which is the modern CSS approach for vertical native range inputs, but Chrome's vertical-mode rendering of input[type=range] has known thumb-alignment quirks: the thumb's cross-axis position doesn't centre against the track when the two have different widths (the visible result in the screenshot was a circle floating to the LEFT of the visible track line); now uses transform: rotate(-90deg) on a horizontal slider which gives pixel-perfect alignment across every browser without writing-mode entering the picture; the input is now styled like a normal horizontal slider (track height 6px, thumb 14×14 with margin-top: -4px to centre on the track) and rotated visually at render time; a new .volume-slider-vertical-wrap forces a square 20×80 layout slot for the rotated bounding box so the surrounding popover doesn't shift when the input's pre-rotation width (80px) would otherwise stretch the column

Murtaza Nasir4929142b9041
diff --git a/static/css/styles.css b/static/css/styles.css
index 34469d43..d2225f01 100644
--- a/static/css/styles.css
+++ b/static/css/styles.css
@@ -3213,20 +3213,33 @@ body {
}
/* Vertical volume slider (popup) */
+/* Vertical volume slider implemented as a HORIZONTAL native range
+ input rotated 90 degrees. The previous writing-mode: vertical-lr
+ approach was modern but has known thumb-alignment quirks in Chrome
+ that placed the thumb off-centre from the track (the cross-axis
+ width differences between track and thumb didn't translate cleanly
+ to vertical orientation). Rotation produces a pixel-perfect
+ vertical control across every browser that supports range inputs.
+
+ Wrapper element is responsible for reserving the rotated bounding
+ box; see .volume-slider-vertical-wrap below. */
.volume-slider-vertical {
-webkit-appearance: none;
appearance: none;
background: transparent;
cursor: pointer;
- writing-mode: vertical-lr;
- direction: rtl;
- width: 20px;
+ /* Horizontal "width" becomes the visible LENGTH of the rotated
+ slider, so the inline style sets this; CSS-controlled height
+ gives it the touch slop while keeping the track narrow. */
+ height: 20px;
+ transform: rotate(-90deg);
+ transform-origin: center center;
}
.volume-slider-vertical::-webkit-slider-runnable-track {
background: var(--border-accent);
opacity: 0.5;
- width: 6px;
+ height: 6px;
border-radius: 3px;
}
@@ -3244,12 +3257,16 @@ body {
background: var(--text-accent);
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
cursor: pointer;
+ /* Lift the thumb up so its centre aligns with the centre of the
+ 6 px track (default behaviour leaves it sitting on the track's
+ baseline). margin-top is the standard cross-browser trick. */
+ margin-top: -4px;
}
.volume-slider-vertical::-moz-range-track {
background: var(--border-accent);
opacity: 0.5;
- width: 6px;
+ height: 6px;
border-radius: 3px;
}
@@ -3268,6 +3285,18 @@ body {
cursor: pointer;
}
+/* Wrapper that reserves a SQUARE bounding box for the rotated slider.
+ The rotation happens around the centre, so the rotated visible
+ extent matches the input's pre-rotation width — but the layout box
+ stays at the pre-rotation aspect ratio, which would shift the
+ surrounding column. Setting the wrapper to width and height equal
+ to the rotated extent gives the popover a clean square slot. */
+.volume-slider-vertical-wrap {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+}
+
/* Player play button - accent colored with proper contrast */
.player-play-button {
background-color: var(--text-accent);
diff --git a/templates/components/detail/audio-player.html b/templates/components/detail/audio-player.html
index 936017f6..ce3d064b 100644
--- a/templates/components/detail/audio-player.html
+++ b/templates/components/detail/audio-player.html
@@ -211,11 +211,18 @@
@mouseleave="showVolumeSlider = false">
<div class="px-3 py-2 bg-[var(--bg-tertiary)] border border-[var(--border-accent)] rounded-lg shadow-xl flex flex-col items-center gap-1">
<span class="text-[10px] font-mono text-[var(--text-muted)]">${ Math.round(playerVolume * 100) }</span>
- <input type="range" min="0" max="1" step="0.05"
- :value="audioIsMuted ? 0 : playerVolume"
- @input="(e) => setAudioVolume(parseFloat(e.target.value))"
- class="volume-slider-vertical"
- style="height: 80px;">
+ <!-- The rotated input reserves a layout box
+ equal to its pre-rotation width × height,
+ so the wrap forces a square slot the
+ rotation can spin inside without
+ shifting the popover's centre. -->
+ <div class="volume-slider-vertical-wrap" style="width: 20px; height: 80px;">
+ <input type="range" min="0" max="1" step="0.05"
+ :value="audioIsMuted ? 0 : playerVolume"
+ @input="(e) => setAudioVolume(parseFloat(e.target.value))"
+ class="volume-slider-vertical"
+ style="width: 80px;">
+ </div>
</div>
</div>
</div>