fix(webapp): tab navigation (#9255)

This commit is contained in:
Ulf Gebhardt 2026-02-21 06:07:48 +01:00 committed by GitHub
parent bbad57bbc7
commit ca05026c1f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 40 additions and 8 deletions

View File

@ -427,21 +427,30 @@ export default {
methods: { methods: {
handleScroll() { handleScroll() {
const currentScrollPos = window.pageYOffset const currentScrollPos = window.pageYOffset
const wasHidden = this.hideNavbar
if (this.prevScrollpos > 50) { if (this.prevScrollpos > 50) {
if (this.prevScrollpos > currentScrollPos) { this.hideNavbar = this.prevScrollpos <= currentScrollPos
this.hideNavbar = false
} else {
this.hideNavbar = true
}
} }
this.prevScrollpos = currentScrollPos this.prevScrollpos = currentScrollPos
if (wasHidden !== this.hideNavbar) {
this.$nextTick(() => this.updateHeaderOffset())
}
},
updateHeaderOffset() {
const el = this.$el
if (el) {
const height = this.hideNavbar ? 0 : el.offsetHeight
document.documentElement.style.setProperty('--header-height', `${height}px`)
}
}, },
toggleMobileMenuView() { toggleMobileMenuView() {
this.toggleMobileMenu = !this.toggleMobileMenu this.toggleMobileMenu = !this.toggleMobileMenu
this.$nextTick(() => this.updateHeaderOffset())
}, },
}, },
mounted() { mounted() {
window.addEventListener('scroll', this.handleScroll) window.addEventListener('scroll', this.handleScroll)
this.$nextTick(() => this.updateHeaderOffset())
}, },
beforeDestroy() { beforeDestroy() {
window.removeEventListener('scroll', this.handleScroll) window.removeEventListener('scroll', this.handleScroll)

View File

@ -61,7 +61,6 @@ export default {
.Tabs { .Tabs {
position: relative; position: relative;
background-color: #fff;
height: 100%; height: 100%;
display: flex; display: flex;
margin: 0; margin: 0;
@ -90,8 +89,13 @@ export default {
} }
.tab-navigation { .tab-navigation {
position: sticky; position: sticky;
top: 53px; top: var(--header-height, 53px);
z-index: 2; z-index: $z-index-sticky;
transition: top 0.15s ease;
@media (prefers-reduced-motion: reduce) {
transition: none;
}
} }
.ds-tab-nav.os-card { .ds-tab-nav.os-card {
padding: 0 !important; padding: 0 !important;
@ -108,4 +112,23 @@ export default {
} }
} }
} }
@supports (container-type: scroll-state) {
.tab-navigation {
container-type: scroll-state;
container-name: tab-nav;
}
.ds-tab-nav.os-card {
border-radius: $border-radius-x-large $border-radius-x-large 0 0 !important;
transition: border-radius 0.15s ease;
@media (prefers-reduced-motion: reduce) {
transition: none;
}
}
@container tab-nav scroll-state(stuck: top) {
.ds-tab-nav.os-card {
border-radius: 0 !important;
}
}
}
</style> </style>