Skip to content

Commit e941749

Browse files
authored
fix: reset selected tab when element changes (#115)
1 parent 0166329 commit e941749

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/api-viewer-demo.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,16 @@ class ApiViewerDemo extends LitElement {
201201
}
202202
}
203203

204+
protected updated(props: PropertyValues): void {
205+
// Reset the focused tab
206+
if (props.has('tag') && props.get('tag')) {
207+
const tabs = this.renderRoot.querySelector('api-viewer-tabs');
208+
if (tabs) {
209+
tabs.selectFirst();
210+
}
211+
}
212+
}
213+
204214
private _onLogClear(): void {
205215
this.eventsController.clear();
206216
const tab = this.querySelector('#events') as HTMLElement;

0 commit comments

Comments
 (0)