@@ -93,7 +97,8 @@ import {
useRouter,
FolderViewModeConstants,
useExtensionRegistry,
- ActionExtension
+ ActionExtension,
+ useIsTopBarSticky
} from '../../composables'
import { BreadcrumbItem } from 'design-system/src/components/OcBreadcrumb/types'
import { useActiveLocation } from '../../composables'
@@ -154,6 +159,7 @@ export default defineComponent({
const { can } = useAbility()
const router = useRouter()
const { requestExtensions } = useExtensionRegistry()
+ const { isSticky } = useIsTopBarSticky()
const resourcesStore = useResourcesStore()
const { selectedResources } = storeToRefs(resourcesStore)
@@ -275,7 +281,8 @@ export default defineComponent({
breadcrumbTruncationOffset,
fileDroppedBreadcrumb,
pageTitle,
- selectedResources
+ selectedResources,
+ isSticky
}
},
data: function () {
@@ -346,10 +353,14 @@ export default defineComponent({
border-top-right-radius: 15px;
box-sizing: border-box;
z-index: 2;
- position: sticky;
+ position: inherit;
padding: 0 var(--oc-space-medium);
top: 0;
+ &.files-app-bar-sticky {
+ position: sticky;
+ }
+
.files-app-bar-controls {
min-height: 52px;
diff --git a/packages/web-pkg/src/components/FilesList/ResourceTable.vue b/packages/web-pkg/src/components/FilesList/ResourceTable.vue
index dceb6a7ebf7..fc8724ad845 100644
--- a/packages/web-pkg/src/components/FilesList/ResourceTable.vue
+++ b/packages/web-pkg/src/components/FilesList/ResourceTable.vue
@@ -16,7 +16,7 @@
:fields="fields"
:highlighted="selectedIds"
:disabled="disabledResources"
- :sticky="true"
+ :sticky="isSticky"
:header-position="headerPosition"
:drag-drop="dragDrop"
:hover="hover"
@@ -273,7 +273,8 @@ import {
useClipboardStore,
useResourcesStore,
useRouter,
- useCanBeOpenedWithSecureView
+ useCanBeOpenedWithSecureView,
+ useIsTopBarSticky
} from '../../composables'
import ResourceListItem from './ResourceListItem.vue'
import ResourceGhostElement from './ResourceGhostElement.vue'
@@ -528,6 +529,7 @@ export default defineComponent({
const capabilityStore = useCapabilityStore()
const { getMatchingSpace } = useGetMatchingSpace()
const { canBeOpenedWithSecureView } = useCanBeOpenedWithSecureView()
+ const { isSticky } = useIsTopBarSticky()
const {
isLocationPicker,
isFilePicker,
@@ -649,7 +651,8 @@ export default defineComponent({
toggleSelection,
areFileExtensionsShown,
latestSelectedId,
- isResourceClickable
+ isResourceClickable,
+ isSticky
}
},
data() {
diff --git a/packages/web-pkg/src/composables/index.ts b/packages/web-pkg/src/composables/index.ts
index aff095e505f..90dde18b535 100644
--- a/packages/web-pkg/src/composables/index.ts
+++ b/packages/web-pkg/src/composables/index.ts
@@ -14,6 +14,7 @@ export * from './eventBus'
export * from './fileListHeaderPosition'
export * from './filesList'
export * from './folderLink'
+export * from './isTopBarSticky'
export * from './keyboardActions'
export * from './links'
export * from './loadingService'
diff --git a/packages/web-pkg/src/composables/isTopBarSticky/index.ts b/packages/web-pkg/src/composables/isTopBarSticky/index.ts
new file mode 100644
index 00000000000..86c92e82f7e
--- /dev/null
+++ b/packages/web-pkg/src/composables/isTopBarSticky/index.ts
@@ -0,0 +1 @@
+export * from './useIsTopBarSticky'
diff --git a/packages/web-pkg/src/composables/isTopBarSticky/useIsTopBarSticky.ts b/packages/web-pkg/src/composables/isTopBarSticky/useIsTopBarSticky.ts
new file mode 100644
index 00000000000..249e4c96a53
--- /dev/null
+++ b/packages/web-pkg/src/composables/isTopBarSticky/useIsTopBarSticky.ts
@@ -0,0 +1,25 @@
+import { ref, onMounted, onBeforeUnmount } from 'vue'
+
+/**
+ * Determines if the topbar (including table headers) should be sticky or not.
+ * With a vertical height less than 500px, the topbar should not be sticky because
+ * it takes up too much space and overflows content.
+ */
+export const useIsTopBarSticky = () => {
+ const isSticky = ref(true)
+
+ const setIsSticky = () => {
+ isSticky.value = window.innerHeight > 500
+ }
+
+ onMounted(() => {
+ setIsSticky()
+ window.addEventListener('resize', setIsSticky)
+ })
+
+ onBeforeUnmount(() => {
+ window.removeEventListener('resize', setIsSticky)
+ })
+
+ return { isSticky }
+}