Skip to content

Commit

Permalink
fix(tabs): revert isTab check so it is possible to create your own tab
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 568670280
  • Loading branch information
AndrewJakubowicz authored and copybara-github committed Sep 26, 2023
1 parent 036ea7b commit e10186e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions tabs/internal/tab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ export class Tab extends LitElement {
setupHostAria(Tab);
}

/**
* Indicates that the element is a tab for `<md-tabs>`. Useful when
* clients implement their own custom `md-tab` components.
* @nocollapse
*/
static readonly isTab = true;

/**
* Whether or not the tab is selected.
**/
Expand Down
3 changes: 2 additions & 1 deletion tabs/internal/tabs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,5 +307,6 @@ export class Tabs extends LitElement {
}

function isTab(element: unknown): element is Tab {
return element instanceof Tab;
if (!element) return false;
return 'isTab' in element.constructor && element.constructor.isTab === true;
}

0 comments on commit e10186e

Please sign in to comment.