Skip to content

Self-hosted personal gallery application with online photo management and albums, supporting Live/Motion Photos, EXIF parsing, geolocation recognition, and an explore map.

fix(gallery): preserve header accessibility and mobile date range

Timothy Yin8b0c7ac7f68b
diff --git a/packages/gallery/app/components/masonry/Root.vue b/packages/gallery/app/components/masonry/Root.vue
index 78ead290..3599b822 100644
--- a/packages/gallery/app/components/masonry/Root.vue
+++ b/packages/gallery/app/components/masonry/Root.vue
@@ -356,7 +356,10 @@ const scrollToPhoto = (photoIndex: number) => {
<DateRangeIndicator
:date-range="dateRange"
:locations="visibleCities"
- :is-visible="!!dateRange && showFloatingActions && !isMobile"
+ :is-visible="
+ !!dateRange && showFloatingActions && !(isMobile && isFixedHeader)
+ "
+ :is-mobile="isMobile"
:top-offset="isFixedHeader ? fixedHeaderHeight : undefined"
/>
diff --git a/packages/gallery/app/components/masonry/item/HeaderIdentity.vue b/packages/gallery/app/components/masonry/item/HeaderIdentity.vue
index 8e9b8666..e15446e7 100644
--- a/packages/gallery/app/components/masonry/item/HeaderIdentity.vue
+++ b/packages/gallery/app/components/masonry/item/HeaderIdentity.vue
@@ -65,7 +65,6 @@ const avatarUrl = computed(
? '-translate-y-2 opacity-0'
: 'translate-y-0 opacity-100'
"
- :aria-hidden="isFixed && condensed ? 'true' : undefined"
>
<h1
:class="
diff --git a/packages/gallery/app/components/ui/DateRangeIndicator.vue b/packages/gallery/app/components/ui/DateRangeIndicator.vue
index 89deb0a9..58b33e0e 100644
--- a/packages/gallery/app/components/ui/DateRangeIndicator.vue
+++ b/packages/gallery/app/components/ui/DateRangeIndicator.vue
@@ -5,6 +5,7 @@ const props = defineProps<{
dateRange?: string
locations?: string
isVisible: boolean
+ isMobile?: boolean
topOffset?: number
class?: string
}>()
@@ -26,8 +27,21 @@ const dateRangeVariants = {
},
}
-// Keep a gap below the fixed header, mirroring the default top-4/top-6
-// offset used when the page has no fixed header.
+const mobileVariants = {
+ initial: {
+ opacity: 0,
+ y: -20,
+ },
+ animate: {
+ opacity: 1,
+ y: 0,
+ },
+}
+
+// The desktop indicator is a floating card, so it keeps a gap below the fixed
+// header, mirroring the default top-4/top-6 offset it uses without a header.
+// The mobile indicator is an edge-to-edge bar; it intentionally sits flush
+// against the bottom edge of the fixed header instead of using this gap.
const DESKTOP_TOP_GAP = 16
</script>
@@ -35,7 +49,7 @@ const DESKTOP_TOP_GAP = 16
<div>
<AnimatePresence>
<motion.div
- v-if="shouldShow"
+ v-if="shouldShow && !isMobile"
class="fixed left-4 z-50 lg:left-6 flex flex-col gap-1 bg-black/40 backdrop-blur-3xl rounded-xl border border-white/10 px-4 py-2 pb-4 shadow-2xl"
:class="topOffset == null ? 'top-4 lg:top-6' : ''"
:style="
@@ -62,6 +76,32 @@ const DESKTOP_TOP_GAP = 16
>{{ locations }}</span
>
</motion.div>
+
+ <motion.div
+ v-if="shouldShow && isMobile"
+ class="fixed inset-x-0 bottom-auto z-50"
+ :class="topOffset == null ? 'top-0' : ''"
+ :style="topOffset == null ? undefined : { top: `${topOffset}px` }"
+ :initial="mobileVariants.initial"
+ :animate="mobileVariants.animate"
+ :exit="mobileVariants.initial"
+ :transition="{
+ type: 'spring',
+ duration: 0.3,
+ bounce: 0.1,
+ }"
+ >
+ <div
+ class="bg-black/60 backdrop-blur-3xl border-b border-white/10 px-4 py-2 shadow-2xl flex flex-col"
+ >
+ <span class="text-white text-lg font-medium">{{ dateRange }}</span>
+ <span
+ v-if="locations"
+ class="text-white/80 text-xs"
+ >{{ locations }}</span
+ >
+ </div>
+ </motion.div>
</AnimatePresence>
</div>
</template>