Skip to content

Commit ea518d0

Browse files
fix(labs): removing hasConstructed and setting privateIsConstructed to handle setting tabIndex
1 parent a6b8c09 commit ea518d0

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

labs/behaviors/focusable.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ const privateIsFocusable = Symbol('privateIsFocusable');
3030
const externalTabIndex = Symbol('externalTabIndex');
3131
const isUpdatingTabIndex = Symbol('isUpdatingTabIndex');
3232
const updateTabIndex = Symbol('updateTabIndex');
33-
const hasConstructed = Symbol('hasConstructed');
3433

3534
/**
3635
* Mixes in focusable functionality for a class.
@@ -68,20 +67,18 @@ export function mixinFocusable<T extends MixinBase<LitElement>>(
6867
this[updateTabIndex]();
6968
}
7069

71-
[privateIsFocusable] = false;
70+
[privateIsFocusable] = true;
7271
[externalTabIndex]: number | null = null;
7372
[isUpdatingTabIndex] = false;
74-
[hasConstructed] = false;
7573

7674
// tslint:disable-next-line:no-any
7775
constructor(...args: any[]) {
7876
super(...args);
7977
this[isFocusable] = true;
8078
}
8179

82-
connectedCallback() {
80+
override connectedCallback() {
8381
super.connectedCallback();
84-
this[hasConstructed] = true;
8582
this[updateTabIndex]();
8683
}
8784

@@ -112,11 +109,6 @@ export function mixinFocusable<T extends MixinBase<LitElement>>(
112109
}
113110

114111
[updateTabIndex]() {
115-
if (!this[hasConstructed]) {
116-
// Custom elements may not hydrate attributes during construction.
117-
return;
118-
}
119-
120112
const internalTabIndex = this[isFocusable] ? 0 : -1;
121113
const computedTabIndex = this[externalTabIndex] ?? internalTabIndex;
122114

0 commit comments

Comments
 (0)