* Sets the tablist to its default initial state. * * Sets the active index of the tablist to the first focusable selected * tab if one exists. Otherwise, sets focus to the first focusable tab. * * This method should be called once the tablist and its tabs are properly initialized.
()
| 225 | * This method should be called once the tablist and its tabs are properly initialized. |
| 226 | */ |
| 227 | setDefaultState() { |
| 228 | let firstItem: TabPattern | undefined; |
| 229 | |
| 230 | for (const item of this.inputs.items()) { |
| 231 | if (!this.focusBehavior.isFocusable(item)) continue; |
| 232 | |
| 233 | if (firstItem === undefined) { |
| 234 | firstItem = item; |
| 235 | } |
| 236 | |
| 237 | if (item.selected()) { |
| 238 | this.inputs.activeItem.set(item); |
| 239 | return; |
| 240 | } |
| 241 | } |
| 242 | if (firstItem !== undefined) { |
| 243 | this.inputs.activeItem.set(firstItem); |
| 244 | } |
| 245 | } |
| 246 | |
| 247 | /** Sets the default active state of the tablist before receiving interaction for the first time. */ |
| 248 | setDefaultStateEffect(): void { |
no test coverage detected