Skip to content

Commit f81931c

Browse files
committed
Frontend: only look at top-level tabs, not nested tabs
Refs adieyal/sd-dynamic-prompts#459 (comment)
1 parent b957dcf commit f81931c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

script.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,18 @@ function gradioApp() {
1010
return elem.shadowRoot ? elem.shadowRoot : elem;
1111
}
1212

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

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

2127
var uiUpdateCallbacks = [];

0 commit comments

Comments
 (0)