Skip to content

Commit 0a478e9

Browse files
committed
feat(aria/tabs): Extend public api with open methods
1 parent 8551314 commit 0a478e9

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/aria/tabs/tabs.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,17 @@ export class Tabs {
107107
this._unorderedPanels.set(new Set(this._unorderedPanels()));
108108
}
109109
}
110+
111+
/** Opens the tab panel with the specified value. */
112+
open(value: string) {
113+
const tab = this._findTabPatternByValue(value);
114+
115+
tab?.expansion.open();
116+
}
117+
118+
_findTabPatternByValue(value: string) {
119+
return this.tabs()?.find(t => t.value() === value);
120+
}
110121
}
111122

112123
/**
@@ -272,6 +283,11 @@ export class Tab implements HasElement, OnInit, OnDestroy {
272283
value: this.value,
273284
});
274285

286+
/** Opens this tab panel. */
287+
open() {
288+
this._pattern.expansion.open();
289+
}
290+
275291
ngOnInit() {
276292
this._tabList.register(this);
277293
}

0 commit comments

Comments
 (0)