techfreakworm commited on
Commit
337d12c
·
unverified ·
1 Parent(s): 6bd9581

fix(ui): click-outside dismisses drawer + darker scrim with blur + ≡⇄× affordance

Browse files
Files changed (1) hide show
  1. app.py +22 -6
app.py CHANGED
@@ -146,6 +146,8 @@ _CUSTOM_CSS = """
146
  padding: 11px 18px;
147
  border-bottom: 1px solid #262C35;
148
  background: #12161B;
 
 
149
  }
150
  .aio-ham-label {
151
  display: none;
@@ -249,7 +251,9 @@ _CUSTOM_CSS = """
249
  .aio-shell.drawer-open .aio-drawer { left: 0; }
250
  .aio-shell.drawer-open::before {
251
  content: ""; position: fixed; inset: 0;
252
- background: rgba(0,0,0,0.55); z-index: 9;
 
 
253
  }
254
 
255
  /* Mobile sub-tweaks */
@@ -310,17 +314,29 @@ _TOPAZ_THEME = gr.themes.Base(
310
 
311
  def build_app() -> gr.Blocks:
312
  with gr.Blocks(theme=_TOPAZ_THEME, title="LTX 2.3 Studio", css=_CUSTOM_CSS) as app:
313
- # Header: hamburger button toggles `.drawer-open` class on `.aio-shell`
314
- # via inline JS (Gradio prefixes user CSS so `body:has(:checked)` breaks).
 
315
  gr.HTML(
316
  '<div class="aio-header">'
317
  ' <button type="button" class="aio-ham-label" '
318
- ' onclick="document.querySelector(\'.aio-shell\')'
319
- '?.classList.toggle(\'drawer-open\')" '
320
- ' aria-label="Toggle navigation">≡</button>'
 
 
321
  ' <span class="aio-title">LTX 2.3 <span class="accent">Studio</span></span>'
322
  ' <span class="aio-mode-tag" id="aio-mode-tag">T2V</span>'
323
  '</div>'
 
 
 
 
 
 
 
 
 
324
  )
325
 
326
  with gr.Row(elem_classes=["aio-shell"]):
 
146
  padding: 11px 18px;
147
  border-bottom: 1px solid #262C35;
148
  background: #12161B;
149
+ position: relative;
150
+ z-index: 11;
151
  }
152
  .aio-ham-label {
153
  display: none;
 
251
  .aio-shell.drawer-open .aio-drawer { left: 0; }
252
  .aio-shell.drawer-open::before {
253
  content: ""; position: fixed; inset: 0;
254
+ background: rgba(0,0,0,0.75); z-index: 9;
255
+ backdrop-filter: blur(4px);
256
+ -webkit-backdrop-filter: blur(4px);
257
  }
258
 
259
  /* Mobile sub-tweaks */
 
314
 
315
  def build_app() -> gr.Blocks:
316
  with gr.Blocks(theme=_TOPAZ_THEME, title="LTX 2.3 Studio", css=_CUSTOM_CSS) as app:
317
+ # Header: hamburger button toggles `.drawer-open` on `.aio-shell`.
318
+ # The script also installs a once-only click-outside dismisser so tapping
319
+ # the scrim, header, or any non-drawer element closes the drawer.
320
  gr.HTML(
321
  '<div class="aio-header">'
322
  ' <button type="button" class="aio-ham-label" '
323
+ ' onclick="(function(b){var s=document.querySelector(\'.aio-shell\');'
324
+ 'var o=s.classList.toggle(\'drawer-open\');'
325
+ 'b.textContent=o?\'\\u00d7\':\'\\u2261\';'
326
+ 'b.setAttribute(\'aria-expanded\',o?\'true\':\'false\');})(this)" '
327
+ ' aria-expanded="false" aria-label="Toggle navigation">≡</button>'
328
  ' <span class="aio-title">LTX 2.3 <span class="accent">Studio</span></span>'
329
  ' <span class="aio-mode-tag" id="aio-mode-tag">T2V</span>'
330
  '</div>'
331
+ '<script>(function(){if(window._aioDismiss)return;window._aioDismiss=true;'
332
+ 'document.addEventListener("click",function(e){'
333
+ 'var s=document.querySelector(".aio-shell");'
334
+ 'if(!s||!s.classList.contains("drawer-open"))return;'
335
+ 'if(e.target.closest(".aio-drawer")||e.target.closest(".aio-ham-label"))return;'
336
+ 's.classList.remove("drawer-open");'
337
+ 'var b=document.querySelector(".aio-ham-label");'
338
+ 'if(b){b.textContent="\\u2261";b.setAttribute("aria-expanded","false");}'
339
+ '});})();</script>'
340
  )
341
 
342
  with gr.Row(elem_classes=["aio-shell"]):