Spaces:
Sleeping
Sleeping
Pointf5ive commited on
Commit ·
78b39e3
1
Parent(s): d1efc39
Stabilize tab navigation by removing fragile tab CSS/JS overrides
Browse files
app.py
CHANGED
|
@@ -71,33 +71,7 @@ CSS = """
|
|
| 71 |
|
| 72 |
footer { display: none !important; }
|
| 73 |
|
| 74 |
-
|
| 75 |
-
position: sticky !important;
|
| 76 |
-
top: 0 !important;
|
| 77 |
-
z-index: 60 !important;
|
| 78 |
-
background: #fffaf0 !important;
|
| 79 |
-
border-bottom: 1px solid var(--studio-line);
|
| 80 |
-
padding: 8px 10px;
|
| 81 |
-
gap: 8px;
|
| 82 |
-
overflow: visible !important;
|
| 83 |
-
}
|
| 84 |
-
|
| 85 |
-
.gradio-container [role="tab"] {
|
| 86 |
-
opacity: 1 !important;
|
| 87 |
-
visibility: visible !important;
|
| 88 |
-
color: var(--studio-ink) !important;
|
| 89 |
-
background: #f4ecd6 !important;
|
| 90 |
-
border: 1px solid var(--studio-line) !important;
|
| 91 |
-
border-radius: 8px !important;
|
| 92 |
-
padding: 8px 14px !important;
|
| 93 |
-
font-weight: 700 !important;
|
| 94 |
-
}
|
| 95 |
-
|
| 96 |
-
.gradio-container [role="tab"][aria-selected="true"] {
|
| 97 |
-
background: linear-gradient(90deg, #f5c93c, #e5a721) !important;
|
| 98 |
-
color: white !important;
|
| 99 |
-
border-color: #d99e1b !important;
|
| 100 |
-
}
|
| 101 |
|
| 102 |
.nav-item[role="button"] {
|
| 103 |
cursor: pointer;
|
|
@@ -260,52 +234,7 @@ footer { display: none !important; }
|
|
| 260 |
}
|
| 261 |
"""
|
| 262 |
|
| 263 |
-
HEAD = ""
|
| 264 |
-
<script>
|
| 265 |
-
(() => {
|
| 266 |
-
const switchToCodexTab = () => {
|
| 267 |
-
const tabs = Array.from(document.querySelectorAll('[role="tab"]'));
|
| 268 |
-
if (!tabs.length) return false;
|
| 269 |
-
const target = tabs.find((tab) => /codex extractor/i.test((tab.textContent || "").trim()));
|
| 270 |
-
if (target) {
|
| 271 |
-
target.click();
|
| 272 |
-
return true;
|
| 273 |
-
}
|
| 274 |
-
if (tabs.length > 1) {
|
| 275 |
-
tabs[1].click();
|
| 276 |
-
return true;
|
| 277 |
-
}
|
| 278 |
-
return false;
|
| 279 |
-
};
|
| 280 |
-
|
| 281 |
-
const bindSidebarCodexLinks = () => {
|
| 282 |
-
document.querySelectorAll('.js-open-codex').forEach((el) => {
|
| 283 |
-
if (el.dataset.boundCodexNav === "1") return;
|
| 284 |
-
el.dataset.boundCodexNav = "1";
|
| 285 |
-
el.addEventListener('click', (e) => {
|
| 286 |
-
e.preventDefault();
|
| 287 |
-
switchToCodexTab();
|
| 288 |
-
});
|
| 289 |
-
el.addEventListener('keydown', (e) => {
|
| 290 |
-
if (e.key === 'Enter' || e.key === ' ') {
|
| 291 |
-
e.preventDefault();
|
| 292 |
-
switchToCodexTab();
|
| 293 |
-
}
|
| 294 |
-
});
|
| 295 |
-
});
|
| 296 |
-
};
|
| 297 |
-
|
| 298 |
-
const observer = new MutationObserver(() => bindSidebarCodexLinks());
|
| 299 |
-
observer.observe(document.documentElement, { childList: true, subtree: true });
|
| 300 |
-
|
| 301 |
-
if (document.readyState === 'loading') {
|
| 302 |
-
document.addEventListener('DOMContentLoaded', bindSidebarCodexLinks);
|
| 303 |
-
} else {
|
| 304 |
-
bindSidebarCodexLinks();
|
| 305 |
-
}
|
| 306 |
-
})();
|
| 307 |
-
</script>
|
| 308 |
-
"""
|
| 309 |
|
| 310 |
|
| 311 |
REVISION_ACTIONS = {
|
|
|
|
| 71 |
|
| 72 |
footer { display: none !important; }
|
| 73 |
|
| 74 |
+
/* Keep native Gradio tab behavior for reliability across Gradio 6 updates. */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
|
| 76 |
.nav-item[role="button"] {
|
| 77 |
cursor: pointer;
|
|
|
|
| 234 |
}
|
| 235 |
"""
|
| 236 |
|
| 237 |
+
HEAD = ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 238 |
|
| 239 |
|
| 240 |
REVISION_ACTIONS = {
|