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 30d88e9b41
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: {
handleScroll() {
const currentScrollPos = window.pageYOffset
const wasHidden = this.hideNavbar
if (this.prevScrollpos > 50) {
if (this.prevScrollpos > currentScrollPos) {
this.hideNavbar = false
} else {
this.hideNavbar = true
}
this.hideNavbar = 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() {
this.toggleMobileMenu = !this.toggleMobileMenu
this.$nextTick(() => this.updateHeaderOffset())
},
},
mounted() {
window.addEventListener('scroll', this.handleScroll)
this.$nextTick(() => this.updateHeaderOffset())
},
beforeDestroy() {
window.removeEventListener('scroll', this.handleScroll)

View File

@ -61,7 +61,6 @@ export default {
.Tabs {
position: relative;
background-color: #fff;
height: 100%;
display: flex;
margin: 0;
@ -90,8 +89,13 @@ export default {
}
.tab-navigation {
position: sticky;
top: 53px;
z-index: 2;
top: var(--header-height, 53px);
z-index: $z-index-sticky;
transition: top 0.15s ease;
@media (prefers-reduced-motion: reduce) {
transition: none;
}
}
.ds-tab-nav.os-card {
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>