From 1e0fedca3da4c0a4a5877f1118fe6fcdc31a398a Mon Sep 17 00:00:00 2001 From: seb Date: Thu, 6 Aug 2026 00:40:27 +0200 Subject: [PATCH] u --- src/components/AppShell.jsx | 8 ++++++++ src/components/article/ArticleTileTab.jsx | 17 ++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/components/AppShell.jsx b/src/components/AppShell.jsx index 9b77d52..669b1d0 100644 --- a/src/components/AppShell.jsx +++ b/src/components/AppShell.jsx @@ -27,6 +27,10 @@ class AppSidebar extends PureComponent { display: 'flex', flexDirection: 'column', bgcolor: theme.nav.background, + position: 'sticky', + top: 0, + alignSelf: 'flex-start', + height: '100vh', })} > @@ -107,6 +111,10 @@ class AppSubNav extends PureComponent { flexDirection: 'column', alignItems: 'center', gap: 1, + position: 'sticky', + top: 0, + alignSelf: 'flex-start', + py: 4, }} > {subNav.map(({ segment, label, icon: Icon }) => { diff --git a/src/components/article/ArticleTileTab.jsx b/src/components/article/ArticleTileTab.jsx index dc571e6..49d0c33 100644 --- a/src/components/article/ArticleTileTab.jsx +++ b/src/components/article/ArticleTileTab.jsx @@ -16,12 +16,14 @@ import { DEFAULT_ARTICLE_TAB, artikelDetailPath, articleShowsCompoundTab, + articleSku, articleTabFromPathname, readPreferredArticleTab, resolveArticleTab, writePreferredArticleTab, } from '../../pages/artikel/articleRoute'; import { router } from '../../appRouter'; +import { matchPath } from 'react-router-dom'; import { PanelTile } from '../panels'; import { PANEL_TILE_BORDER_RADIUS, responsiveColumnSpan } from '../panels/panelTileLayout'; import ArticleAttributesTab from './tabs/ArticleAttributesTab'; @@ -77,6 +79,18 @@ function readRouteTab() { return articleTabFromPathname(router.state.location.pathname); } +/** True only while the URL is this article’s detail route. */ +function isOnArticleDetail(article) { + const sku = articleSku(article); + if (!sku) return false; + const match = matchPath( + '/artikel/:sku/:tab?', + router.state.location.pathname, + ); + if (!match?.params?.sku) return false; + return decodeURIComponent(match.params.sku) === sku; +} + class ArticleTileTab extends PureComponent { constructor(props) { super(props); @@ -106,6 +120,7 @@ class ArticleTileTab extends PureComponent { } syncTabFromRouter() { + if (!isOnArticleDetail(this.props.article)) return; const tabParam = readRouteTab(); if (tabParam !== this.state.tabParam) { this.setState({ tabParam }, () => this.ensureValidTab()); @@ -115,7 +130,7 @@ class ArticleTileTab extends PureComponent { ensureValidTab() { const { article } = this.props; const { tabParam } = this.state; - if (!article) return; + if (!article || !isOnArticleDetail(article)) return; const resolved = resolveArticleTab(tabParam, article); if (tabParam !== resolved) { void router.navigate(artikelDetailPath(article, resolved), { replace: true });