From 90bada6644f62f4684a0478740d4befc3acdbac6 Mon Sep 17 00:00:00 2001 From: felixw Date: Wed, 20 Sep 2023 09:25:06 +0200 Subject: [PATCH 1/2] fix: set scrolled attribute only when offset is larger than the header --- .../src/components/telekom/telekom-header/telekom-header.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/components/src/components/telekom/telekom-header/telekom-header.tsx b/packages/components/src/components/telekom/telekom-header/telekom-header.tsx index 76a023bbab..4e35f766dd 100644 --- a/packages/components/src/components/telekom/telekom-header/telekom-header.tsx +++ b/packages/components/src/components/telekom/telekom-header/telekom-header.tsx @@ -47,7 +47,7 @@ export class TelekomHeader { @Listen('scroll', { target: 'document' }) onScroll() { - this.scrolled = window.pageYOffset > 2; + this.scrolled = window.pageYOffset > 48; this.scrolledBack = this.pageYOffset !== window.pageYOffset && window.pageYOffset <= 0; this.pageYOffset = pageYOffset; From 0b0c9c3a669dbc54b163e633ecaac804dce2aaa7 Mon Sep 17 00:00:00 2001 From: felixw Date: Thu, 21 Sep 2023 18:32:38 +0200 Subject: [PATCH 2/2] fix: comment hardcoded value and add todo --- .../src/components/telekom/telekom-header/telekom-header.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/components/src/components/telekom/telekom-header/telekom-header.tsx b/packages/components/src/components/telekom/telekom-header/telekom-header.tsx index 4e35f766dd..f1f6661a87 100644 --- a/packages/components/src/components/telekom/telekom-header/telekom-header.tsx +++ b/packages/components/src/components/telekom/telekom-header/telekom-header.tsx @@ -47,6 +47,8 @@ export class TelekomHeader { @Listen('scroll', { target: 'document' }) onScroll() { + // 48px is the height of the header, set scrolled when the user scrolls past it + // todo: calculate this value dynamically (for slim header, smaller viewports, etc) this.scrolled = window.pageYOffset > 48; this.scrolledBack = this.pageYOffset !== window.pageYOffset && window.pageYOffset <= 0;