Skip to content

Commit 145db6e

Browse files
mhaertwiggithub-actions
authored andcommitted
fix(angular/header-menu): close header menu on backdrop click (#2747)
Fixes a bug where the header menu did not close on backdrop click. Fixes #2743
1 parent 18f4f6d commit 145db6e

3 files changed

Lines changed: 5 additions & 2 deletions

File tree

src/angular/header-lean/header-menu.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { NgClass } from '@angular/common';
1010
import {
1111
AfterContentInit,
1212
ChangeDetectionStrategy,
13+
ChangeDetectorRef,
1314
Component,
1415
ContentChildren,
1516
ElementRef,
@@ -56,6 +57,7 @@ import { SBB_HEADER } from './header-token';
5657
})
5758
export class SbbHeaderMenu implements AfterContentInit, OnDestroy {
5859
private _elementRef = inject<ElementRef<HTMLElement>>(ElementRef);
60+
private _changeDetectorRef = inject(ChangeDetectorRef);
5961
_header: SbbHeaderLean = inject<TypeRef<SbbHeaderLean>>(SBB_HEADER);
6062
_backButton: string = $localize`:Go back to the app chooser navigation@@sbbHeaderMenuBack:Back`;
6163

@@ -89,6 +91,7 @@ export class SbbHeaderMenu implements AfterContentInit, OnDestroy {
8991
} else {
9092
this._animationState = 'open-menu';
9193
}
94+
this._changeDetectorRef.markForCheck();
9295
}
9396
}
9497
private _open = false;

src/angular/i18n/xlf/messages.xlf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
<source>Back</source>
107107
<context-group purpose="location">
108108
<context context-type="sourcefile">../../header-lean/header-menu.ts</context>
109-
<context context-type="linenumber">60</context>
109+
<context context-type="linenumber">62</context>
110110
</context-group>
111111
<note priority="1" from="description">Go back to the app chooser navigation</note>
112112
</trans-unit>

src/angular/i18n/xlf2/messages.xlf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
</unit>
113113
<unit id="sbbHeaderMenuBack">
114114
<notes>
115-
<note category="location">../../header-lean/header-menu.ts:60</note>
115+
<note category="location">../../header-lean/header-menu.ts:62</note>
116116
<note category="description">Go back to the app chooser navigation</note>
117117
</notes>
118118
<segment>

0 commit comments

Comments
 (0)