Skip to content

Commit f6c32a1

Browse files
committed
fix
1 parent 0c29bed commit f6c32a1

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

src/aria/private/tabs/tabs.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
WritableSignalLike,
1414
computed,
1515
linkedSignal,
16+
signal,
1617
} from '../behaviors/signal-like/signal-like';
1718
import {LabelControl, LabelControlOptionalInputs} from '../behaviors/label/label';
1819
import {ListFocus} from '../behaviors/list-focus/list-focus';
@@ -83,9 +84,6 @@ export class TabPattern {
8384
export interface TabPanelInputs extends LabelControlOptionalInputs {
8485
/** A global unique identifier for the tabpanel. */
8586
id: SignalLike<string>;
86-
87-
/** The tab that controls this tabpanel. */
88-
tab: SignalLike<TabPattern | undefined>;
8987
}
9088

9189
/** A tabpanel associated with a tab. */
@@ -96,8 +94,11 @@ export class TabPanelPattern {
9694
/** Controls label for this tabpanel. */
9795
readonly labelManager: LabelControl;
9896

97+
/** The tab that controls this tabpanel. */
98+
readonly tab: WritableSignalLike<TabPattern | undefined> = signal(undefined);
99+
99100
/** Whether the tabpanel is hidden. */
100-
readonly hidden = computed(() => this.inputs.tab()?.expanded() === false);
101+
readonly hidden = computed(() => this.tab()?.expanded() === false);
101102

102103
/** The tab index of this tabpanel. */
103104
readonly tabIndex = computed(() => (this.hidden() ? -1 : 0));
@@ -112,7 +113,7 @@ export class TabPanelPattern {
112113
constructor(readonly inputs: TabPanelInputs) {
113114
this.labelManager = new LabelControl({
114115
...inputs,
115-
defaultLabelledBy: computed(() => (this.inputs.tab() ? [this.inputs.tab()!.id()] : [])),
116+
defaultLabelledBy: computed(() => (this.tab() ? [this.tab()!.id()] : [])),
116117
});
117118
}
118119
}

src/aria/tabs/tab-panel.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import {_IdGenerator} from '@angular/cdk/a11y';
1010
import {Directive, ElementRef, afterRenderEffect, computed, inject, input} from '@angular/core';
11-
import {DeferredContentAware, TabPattern, TabPanelPattern} from '../private';
11+
import {DeferredContentAware, TabPanelPattern} from '../private';
1212

1313
/**
1414
* A TabPanel container for the resources of layered content associated with a tab.
@@ -59,16 +59,12 @@ export class TabPanel {
5959
/** A global unique identifier for the tab. */
6060
readonly id = input(inject(_IdGenerator).getId('ng-tabpanel-', true));
6161

62-
/** The Tab UIPattern associated with the tabpanel */
63-
_tabPattern?: TabPattern;
64-
6562
/** Whether the tab panel is visible. */
6663
readonly visible = computed(() => !this._pattern.hidden());
6764

6865
/** The TabPanel UIPattern. */
6966
readonly _pattern: TabPanelPattern = new TabPanelPattern({
7067
...this,
71-
tab: () => this._tabPattern,
7268
});
7369

7470
constructor() {

src/aria/tabs/tab.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export class Tab implements AfterViewInit {
8383
});
8484

8585
ngAfterViewInit() {
86-
this.panel()._tabPattern = this._pattern;
86+
this.panel()._pattern.tab.set(this._pattern);
8787
}
8888

8989
/** Opens this tab panel. */

0 commit comments

Comments
 (0)