Skip to content

Beautiful Open-Source Form Builder

fix(mobile): improve horizontal scroll arrows visibility and padding in SettingsModal

Cursor Agent488928a34f87
diff --git a/client/components/global/NavigationList.vue b/client/components/global/NavigationList.vue
index 0d395a35f..d9212e53a 100644
--- a/client/components/global/NavigationList.vue
+++ b/client/components/global/NavigationList.vue
@@ -28,10 +28,8 @@
-->
<template>
<ul
- :class="[
- 'space-y-1',
- listClass
- ]"
+ ref="listRef"
+ :class="listClass"
:style="listClass.includes('overflow-x-auto') ? 'scrollbar-width: none; -ms-overflow-style: none;' : ''"
>
<li v-for="item in items" :key="item.label || item.id">
@@ -67,6 +65,12 @@
<script setup>
import TrackClick from '~/components/global/TrackClick.vue'
+// Expose the root element for parent components to use with scroll/resize observers
+const listRef = ref(null)
+defineExpose({
+ $el: listRef
+})
+
const props = defineProps({
items: {
type: Array,
@@ -98,7 +102,7 @@ const props = defineProps({
},
listClass: {
type: String,
- default: ''
+ default: 'space-y-1'
}
})
diff --git a/client/components/pages/settings/SettingsModal.vue b/client/components/pages/settings/SettingsModal.vue
index 8e9406ee1..613252444 100644
--- a/client/components/pages/settings/SettingsModal.vue
+++ b/client/components/pages/settings/SettingsModal.vue
@@ -125,7 +125,11 @@ const activeTabRef = ref(props.activeTab)
// --- Responsive Nav Scrolling ---
const navContainer = ref(null)
-const { x: scrollX } = useScroll(navContainer)
+
+// Get the actual DOM element from the NavigationList component
+const navElement = computed(() => navContainer.value?.$el)
+
+const { x: scrollX } = useScroll(navElement)
const contentWidth = ref(0)
const containerWidth = ref(0)
@@ -135,19 +139,30 @@ const showRightArrow = computed(() => {
return scrollX.value < contentWidth.value - containerWidth.value - 1 // -1 for subpixel precision
})
-useResizeObserver(navContainer, (entries) => {
+// Update dimensions from the element
+function updateNavDimensions() {
+ const el = navElement.value
+ if (el) {
+ containerWidth.value = el.clientWidth
+ contentWidth.value = el.scrollWidth
+ }
+}
+
+useResizeObserver(navElement, (entries) => {
const entry = entries[0]
containerWidth.value = entry.contentRect.width
- if (navContainer.value) {
- contentWidth.value = navContainer.value.scrollWidth
+ const el = navElement.value
+ if (el) {
+ contentWidth.value = el.scrollWidth
}
})
function scrollNav(direction) {
- if (navContainer.value) {
+ const el = navElement.value
+ if (el) {
// Scroll by 80% of the container's width for a better user experience
const scrollAmount = containerWidth.value * 0.8 * direction
- navContainer.value.scrollBy({ left: scrollAmount, behavior: 'smooth' })
+ el.scrollBy({ left: scrollAmount, behavior: 'smooth' })
}
}
@@ -219,6 +234,10 @@ watch(isOpen, (newValue) => {
activeTabRef.value = getFirstItemId()
}
}
+
+ // Initialize nav dimensions after modal content is rendered
+ // This ensures the right arrow is visible on mobile when there are more items
+ nextTick(() => updateNavDimensions())
})
}
})
@@ -235,6 +254,10 @@ watch(registeredPages, () => {
if (!registeredPages.value.some(p => p.id === activeTabRef.value)) {
activeTabRef.value = getFirstItemId()
}
+
+ // Update nav dimensions when pages are registered/unregistered
+ // This ensures scroll indicators are accurate
+ nextTick(() => updateNavDimensions())
}, { deep: true })
// Registration functions for modal pages