Skip to content

Commit 13c92a3

Browse files
authored
refactor(aria/tabs): remove unnecessary LabelControl usage (angular#33148)
1 parent cbc907b commit 13c92a3

2 files changed

Lines changed: 3 additions & 17 deletions

File tree

goldens/aria/private/index.api.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ export class TabListPattern {
707707
}
708708

709709
// @public
710-
export interface TabPanelInputs extends LabelControlOptionalInputs {
710+
export interface TabPanelInputs {
711711
id: SignalLike<string>;
712712
readonly tab: SignalLike<TabPattern | undefined>;
713713
}
@@ -720,7 +720,6 @@ export class TabPanelPattern {
720720
// (undocumented)
721721
readonly inputs: TabPanelInputs;
722722
readonly labelledBy: SignalLike<string | undefined>;
723-
readonly labelManager: LabelControl;
724723
readonly tabIndex: SignalLike<-1 | 0>;
725724
}
726725

src/aria/private/tabs/tabs.ts

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import {
1515
linkedSignal,
1616
signal,
1717
} from '../behaviors/signal-like/signal-like';
18-
import {LabelControl, LabelControlOptionalInputs} from '../behaviors/label/label';
1918
import {ListFocus} from '../behaviors/list-focus/list-focus';
2019
import {
2120
ListNavigation,
@@ -81,7 +80,7 @@ export class TabPattern {
8180
}
8281

8382
/** The required inputs for the tabpanel. */
84-
export interface TabPanelInputs extends LabelControlOptionalInputs {
83+
export interface TabPanelInputs {
8584
/** A global unique identifier for the tabpanel. */
8685
id: SignalLike<string>;
8786

@@ -94,29 +93,17 @@ export class TabPanelPattern {
9493
/** A global unique identifier for the tabpanel. */
9594
readonly id: SignalLike<string>; // set from inputs
9695

97-
/** Controls label for this tabpanel. */
98-
readonly labelManager: LabelControl;
99-
10096
/** Whether the tabpanel is hidden. */
10197
readonly hidden = computed(() => this.inputs.tab()?.expanded() === false);
10298

10399
/** The tab index of this tabpanel. */
104100
readonly tabIndex = computed(() => (this.hidden() ? -1 : 0));
105101

106102
/** The aria-labelledby value for this tabpanel. */
107-
readonly labelledBy = computed(() =>
108-
this.labelManager.labelledBy().length > 0
109-
? this.labelManager.labelledBy().join(' ')
110-
: undefined,
111-
);
103+
readonly labelledBy = computed(() => this.inputs.tab()?.id());
112104

113105
constructor(readonly inputs: TabPanelInputs) {
114106
this.id = inputs.id;
115-
116-
this.labelManager = new LabelControl({
117-
...inputs,
118-
defaultLabelledBy: computed(() => (this.inputs.tab() ? [this.inputs.tab()!.id()] : [])),
119-
});
120107
}
121108
}
122109

0 commit comments

Comments
 (0)