Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions goldens/aria/private/index.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ export class TabListPattern {
}

// @public
export interface TabPanelInputs extends LabelControlOptionalInputs {
export interface TabPanelInputs {
id: SignalLike<string>;
readonly tab: SignalLike<TabPattern | undefined>;
}
Expand All @@ -720,7 +720,6 @@ export class TabPanelPattern {
// (undocumented)
readonly inputs: TabPanelInputs;
readonly labelledBy: SignalLike<string | undefined>;
readonly labelManager: LabelControl;
readonly tabIndex: SignalLike<-1 | 0>;
}

Expand Down
17 changes: 2 additions & 15 deletions src/aria/private/tabs/tabs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
linkedSignal,
signal,
} from '../behaviors/signal-like/signal-like';
import {LabelControl, LabelControlOptionalInputs} from '../behaviors/label/label';
import {ListFocus} from '../behaviors/list-focus/list-focus';
import {
ListNavigation,
Expand Down Expand Up @@ -81,7 +80,7 @@ export class TabPattern {
}

/** The required inputs for the tabpanel. */
export interface TabPanelInputs extends LabelControlOptionalInputs {
export interface TabPanelInputs {
/** A global unique identifier for the tabpanel. */
id: SignalLike<string>;

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

/** Controls label for this tabpanel. */
readonly labelManager: LabelControl;

/** Whether the tabpanel is hidden. */
readonly hidden = computed(() => this.inputs.tab()?.expanded() === false);

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

/** The aria-labelledby value for this tabpanel. */
readonly labelledBy = computed(() =>
this.labelManager.labelledBy().length > 0
? this.labelManager.labelledBy().join(' ')
: undefined,
);
readonly labelledBy = computed(() => this.inputs.tab()?.id());

constructor(readonly inputs: TabPanelInputs) {
this.id = inputs.id;

this.labelManager = new LabelControl({
...inputs,
defaultLabelledBy: computed(() => (this.inputs.tab() ? [this.inputs.tab()!.id()] : [])),
});
}
}

Expand Down
Loading