Skip to content

Commit

Permalink
Frontend: only look at top-level tabs, not nested tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
akx authored and dario-github committed Jun 27, 2023
1 parent e051b3e commit b14c000
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,18 @@ function gradioApp() {
return elem.shadowRoot ? elem.shadowRoot : elem;
}

/**
* Get the currently selected top-level UI tab button (e.g. the button that says "Extras").
*/
function get_uiCurrentTab() {
return gradioApp().querySelector('#tabs button.selected');
return gradioApp().querySelector('#tabs > .tab-nav > button.selected');
}

/**
* Get the first currently visible top-level UI tab content (e.g. the div hosting the "txt2img" UI).
*/
function get_uiCurrentTabContent() {
return gradioApp().querySelector('.tabitem[id^=tab_]:not([style*="display: none"])');
return gradioApp().querySelector('#tabs > .tabitem[id^=tab_]:not([style*="display: none"])');
}

var uiUpdateCallbacks = [];
Expand Down

0 comments on commit b14c000

Please sign in to comment.