Skip to content

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

Python

Toast container — simple fixed top-right, offset by the page header height — reverted the work-area-anchored positioning (commit 7adcb11) per request; now uses top: calc(var(--app-header-height, 56px) + 16px) and right: 16px so toasts sit BELOW the page header bar rather than overlapping it; uses the same --app-header-height variable the sidebar already uses for its own top offset, so any future change to the header height adjusts both in one place; no JS, no ResizeObserver, no retry loop — plain CSS

Murtaza Nasirc60d29d90bbf
diff --git a/templates/modals/toast-container.html b/templates/modals/toast-container.html
index 9ee4bff7..9a696ef5 100644
--- a/templates/modals/toast-container.html
+++ b/templates/modals/toast-container.html
@@ -1,68 +1,9 @@
<!-- Toast Container.
- Anchored to the TOP-RIGHT of the active work area (#mainContentColumns)
- when present — same single source of truth the floating chat uses, so
- any layout change that affects the chat bounds also moves the toasts
- consistently (sidebar collapse, column resize, audio player flip
- top↔bottom, mobile bottom-nav presence, viewport resize). Falls back
- to the viewport top-right corner when #mainContentColumns isn't on
- the page (e.g. settings, admin, inquire).
-
- Implementation note: the container is fixed-positioned, with top + right
- offsets computed from the columns rect. A ResizeObserver on the columns
- element handles size changes and window-resize handles the fallback. -->
+ Fixed in the top-right of the viewport, offset by the page header
+ height so toasts sit BELOW the header bar rather than overlapping it.
+ --app-header-height is the same variable the sidebar uses for its top
+ offset (56px today); the +16px inset matches the existing right edge
+ inset. Plain CSS — no JS, no observers, no fragility. -->
<div id="toastContainer" class="fixed z-50 pointer-events-none"
- style="top: 16px; right: 16px;"></div>
-
-<script>
-(function () {
- var INSET = 16;
- var container = document.getElementById('toastContainer');
- if (!container) return;
-
- function update() {
- var anchor = document.getElementById('mainContentColumns');
- if (anchor) {
- var r = anchor.getBoundingClientRect();
- // When the columns are off-screen (e.g. on a tab without the
- // detail view), fall back to the viewport corner.
- if (r.width > 0 && r.bottom > 0 && r.top < window.innerHeight) {
- container.style.top = Math.max(0, r.top + INSET) + 'px';
- container.style.right = Math.max(0, (window.innerWidth - r.right) + INSET) + 'px';
- return;
- }
- }
- container.style.top = INSET + 'px';
- container.style.right = INSET + 'px';
- }
-
- // Initial position.
- update();
-
- // React to any change of the work-area bounds. ResizeObserver fires
- // when the observed element's size changes; window.resize covers the
- // fallback case where #mainContentColumns isn't present yet (Vue
- // mounts later) and also fires reliably on viewport resize.
- var observed = null;
- function ensureObserver() {
- if (typeof ResizeObserver === 'undefined') return;
- var anchor = document.getElementById('mainContentColumns');
- if (!anchor || anchor === observed) return;
- observed = anchor;
- new ResizeObserver(update).observe(anchor);
- }
-
- // Window resize covers fallback + size changes the observer doesn't.
- window.addEventListener('resize', update, { passive: true });
-
- // #mainContentColumns is created by Vue after mount. Retry attaching
- // the observer for a short window so we don't miss the late mount.
- ensureObserver();
- var attempts = 0;
- var retryTimer = setInterval(function () {
- ensureObserver();
- update();
- if (++attempts >= 20 || observed) clearInterval(retryTimer);
- }, 150);
-})();
-</script>
+ style="top: calc(var(--app-header-height, 56px) + 16px); right: 16px;"></div>